From d5357c1b399410b2559d32b2fbd4afa92c57d7fa Mon Sep 17 00:00:00 2001 From: Kisaragi Marine Date: Thu, 13 Apr 2023 22:24:33 +0900 Subject: [PATCH 01/97] stdarch: update submodule --- library/stdarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/stdarch b/library/stdarch index b655243782c1..1044810de54e 160000 --- a/library/stdarch +++ b/library/stdarch @@ -1 +1 @@ -Subproject commit b655243782c18d3419439daa523782e0818ecf26 +Subproject commit 1044810de54ea6f4026951e5d54211503ea0bd9e From bf264c7cfcf792329bb4c08a5ae969729cbe9518 Mon Sep 17 00:00:00 2001 From: Chris Copeland Date: Sat, 15 Apr 2023 14:59:19 -0700 Subject: [PATCH 02/97] Update max_atomic_width of armv7r and armv7_sony_vita targets to 64. --- compiler/rustc_target/src/spec/armebv7r_none_eabi.rs | 2 +- compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs | 2 +- compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs | 2 +- compiler/rustc_target/src/spec/armv7r_none_eabi.rs | 2 +- compiler/rustc_target/src/spec/armv7r_none_eabihf.rs | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs index f6f46aac4c39..5632bcfcefe2 100644 --- a/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armebv7r_none_eabi.rs @@ -16,7 +16,7 @@ pub fn target() -> Target { linker: Some("rust-lld".into()), relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, - max_atomic_width: Some(32), + max_atomic_width: Some(64), emit_debug_gdb_scripts: false, // GCC and Clang default to 8 for arm-none here c_enum_min_bits: Some(8), diff --git a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs index 9608efe8bcf6..2815de3589db 100644 --- a/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armebv7r_none_eabihf.rs @@ -17,7 +17,7 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, features: "+vfp3,-d32,-fp16".into(), - max_atomic_width: Some(32), + max_atomic_width: Some(64), emit_debug_gdb_scripts: false, // GCC and Clang default to 8 for arm-none here c_enum_min_bits: Some(8), diff --git a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs index ebd2cca25ea9..9fc6913c70ac 100644 --- a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs @@ -33,7 +33,7 @@ pub fn target() -> Target { pre_link_args, exe_suffix: ".elf".into(), panic_strategy: PanicStrategy::Abort, - max_atomic_width: Some(32), + max_atomic_width: Some(64), ..Default::default() }, } diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs index 5225abf44fca..74905ed5a4e0 100644 --- a/compiler/rustc_target/src/spec/armv7r_none_eabi.rs +++ b/compiler/rustc_target/src/spec/armv7r_none_eabi.rs @@ -15,7 +15,7 @@ pub fn target() -> Target { linker: Some("rust-lld".into()), relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, - max_atomic_width: Some(32), + max_atomic_width: Some(64), emit_debug_gdb_scripts: false, // GCC and Clang default to 8 for arm-none here c_enum_min_bits: Some(8), diff --git a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs index 9a35e04617f9..516b3f5c17ee 100644 --- a/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs +++ b/compiler/rustc_target/src/spec/armv7r_none_eabihf.rs @@ -16,7 +16,7 @@ pub fn target() -> Target { relocation_model: RelocModel::Static, panic_strategy: PanicStrategy::Abort, features: "+vfp3,-d32,-fp16".into(), - max_atomic_width: Some(32), + max_atomic_width: Some(64), emit_debug_gdb_scripts: false, // GCC and Clang default to 8 for arm-none here c_enum_min_bits: Some(8), From cb4f8153d8285ac2bf2145c569c09014f3ba317d Mon Sep 17 00:00:00 2001 From: Charisee Date: Sat, 22 Apr 2023 01:00:36 +0000 Subject: [PATCH 03/97] Add GNU Property Note --- .../rustc_codegen_ssa/src/back/metadata.rs | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index d5d843702c00..baf674cf9eba 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -12,6 +12,7 @@ use object::{ use snap::write::FrameEncoder; +use object::elf::NT_GNU_PROPERTY_TYPE_0; use rustc_data_structures::memmap::Mmap; use rustc_data_structures::owned_slice::try_slice_owned; use rustc_data_structures::sync::MetadataRef; @@ -93,6 +94,46 @@ pub(super) fn search_for_section<'a>( .map_err(|e| format!("failed to read {} section in '{}': {}", section, path.display(), e)) } +fn add_gnu_property_note( + file: &mut write::Object<'static>, + architecture: Architecture, + binary_format: BinaryFormat, +) { + // check bti protection + if binary_format != BinaryFormat::Elf + || !matches!(architecture, Architecture::X86_64 | Architecture::Aarch64) + { + return; + } + + let section = file.add_section( + file.segment_name(StandardSegment::Data).to_vec(), + b".note.gnu.property".to_vec(), + SectionKind::Note, + ); + let mut data: Vec = Vec::new(); + let n_namsz: u32 = 4; // Size of the n_name field + let n_descsz: u32 = 16; // Size of the n_desc field + let n_type: u32 = NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor + let values = [n_namsz, n_descsz, n_type]; + values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))); + data.push(b'G'); // Owner of the program property note + data.push(b'N'); + data.push(b'U'); + data.push(0); + let pr_type: u32 = match architecture { + Architecture::X86_64 => 0xc0000002, + Architecture::Aarch64 => 0xc0000000, + _ => unreachable!(), + }; + let pr_datasz: u32 = 4; //size of the pr_data field + let pr_data: u32 = 3; //program property descriptor + let pr_padding: u32 = 3; + let values = [pr_type, pr_datasz, pr_data, pr_padding]; + values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))); + file.append_section_data(section, &data, 4); +} + pub(crate) fn create_object_file(sess: &Session) -> Option> { let endianness = match sess.target.options.endian { Endian::Little => Endianness::Little, @@ -205,6 +246,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option elf::ELFOSABI_NONE, }; let abi_version = 0; + add_gnu_property_note(&mut file, architecture, binary_format); file.flags = FileFlags::Elf { os_abi, abi_version, e_flags }; Some(file) } From 49413bb619e3ed8d589e7cf7f2d81127b7f6ce36 Mon Sep 17 00:00:00 2001 From: Kisaragi Marine Date: Mon, 24 Apr 2023 05:36:49 +0900 Subject: [PATCH 04/97] stdarch: update submodule, take 2 --- library/stdarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/stdarch b/library/stdarch index 1044810de54e..24c2188ab75d 160000 --- a/library/stdarch +++ b/library/stdarch @@ -1 +1 @@ -Subproject commit 1044810de54ea6f4026951e5d54211503ea0bd9e +Subproject commit 24c2188ab75dbb15c9822e99f712a3a7ad390a8c From 1042b65997084f3c9de06f1c5e64ace28cbe7a26 Mon Sep 17 00:00:00 2001 From: Kisaragi Marine Date: Tue, 25 Apr 2023 05:30:20 +0900 Subject: [PATCH 05/97] stdarch: update submodule, take 3 --- library/stdarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/stdarch b/library/stdarch index 24c2188ab75d..313a8bd2b7ee 160000 --- a/library/stdarch +++ b/library/stdarch @@ -1 +1 @@ -Subproject commit 24c2188ab75dbb15c9822e99f712a3a7ad390a8c +Subproject commit 313a8bd2b7ee5a758afde790cabd6f7717490bcd From 183f1a6a7048e1d35521941c23ec43078ea0a038 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 25 Apr 2023 20:41:59 +0000 Subject: [PATCH 06/97] Fix lifetime suggestion for type aliases with objects in them --- .../src/diagnostics/region_errors.rs | 16 +++++-- compiler/rustc_middle/src/ty/context.rs | 8 ++-- .../suggest-lt-on-ty-alias-w-generics.rs | 11 +++++ .../suggest-lt-on-ty-alias-w-generics.stderr | 43 +++++++++++++++++++ 4 files changed, 72 insertions(+), 6 deletions(-) create mode 100644 tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs create mode 100644 tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 9fcebeb0acdc..328f569bb74f 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -845,7 +845,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { return; } - let Some((alias_tys, alias_span)) = self + let Some((alias_tys, alias_span, lt_addition_span)) = self .infcx .tcx .return_type_impl_or_dyn_traits_with_type_alias(suitable_region.def_id) else { return; }; @@ -858,10 +858,20 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { () } if let TyKind::TraitObject(_, lt, _) = alias_ty.kind { - spans_suggs.push((lt.ident.span.shrink_to_hi(), " + 'a".to_string())); + if lt.ident.name == kw::Empty { + spans_suggs.push((lt.ident.span.shrink_to_hi(), " + 'a".to_string())); + } else { + spans_suggs.push((lt.ident.span, "'a".to_string())); + } } } - spans_suggs.push((alias_span.shrink_to_hi(), "<'a>".to_string())); + + if let Some(lt_addition_span) = lt_addition_span { + spans_suggs.push((lt_addition_span, "'a, ".to_string())); + } else { + spans_suggs.push((alias_span.shrink_to_hi(), "<'a>".to_string())); + } + diag.multipart_suggestion_verbose( &format!( "to declare that the trait object {captures}, you can add a lifetime parameter `'a` in the type alias" diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index 4a4f6770fc46..cf388f3e8551 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1116,11 +1116,13 @@ impl<'tcx> TyCtxt<'tcx> { v.0 } - /// Given a `DefId` for an `fn`, return all the `dyn` and `impl` traits in its return type and associated alias span when type alias is used + /// Given a `DefId` for an `fn`, return all the `dyn` and `impl` traits in + /// its return type, and the associated alias span when type alias is used, + /// along with a span for lifetime suggestion (if there are existing generics). pub fn return_type_impl_or_dyn_traits_with_type_alias( self, scope_def_id: LocalDefId, - ) -> Option<(Vec<&'tcx hir::Ty<'tcx>>, Span)> { + ) -> Option<(Vec<&'tcx hir::Ty<'tcx>>, Span, Option)> { let hir_id = self.hir().local_def_id_to_hir_id(scope_def_id); let mut v = TraitObjectVisitor(vec![], self.hir()); // when the return type is a type alias @@ -1134,7 +1136,7 @@ impl<'tcx> TyCtxt<'tcx> { { v.visit_ty(alias_ty); if !v.0.is_empty() { - return Some((v.0, alias_generics.span)); + return Some((v.0, alias_generics.span, alias_generics.span_for_lifetime_suggestion())); } } return None; diff --git a/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs new file mode 100644 index 000000000000..c9e043577ed6 --- /dev/null +++ b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.rs @@ -0,0 +1,11 @@ +type Lazy = Box T + 'static>; + +fn test(x: &i32) -> Lazy { + Box::new(|| { + //~^ ERROR lifetime may not live long enough + //~| ERROR closure may outlive the current function + *x + }) +} + +fn main() {} diff --git a/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr new file mode 100644 index 000000000000..28b4b4aa290d --- /dev/null +++ b/tests/ui/borrowck/suggest-lt-on-ty-alias-w-generics.stderr @@ -0,0 +1,43 @@ +error: lifetime may not live long enough + --> $DIR/suggest-lt-on-ty-alias-w-generics.rs:4:5 + | +LL | fn test(x: &i32) -> Lazy { + | - let's call the lifetime of this reference `'1` +LL | / Box::new(|| { +LL | | +LL | | +LL | | *x +LL | | }) + | |______^ returning this value requires that `'1` must outlive `'static` + | +help: to declare that the trait object captures data from argument `x`, you can add a lifetime parameter `'a` in the type alias + | +LL | type Lazy<'a, T> = Box T + 'a>; + | +++ ~~ + +error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function + --> $DIR/suggest-lt-on-ty-alias-w-generics.rs:4:14 + | +LL | Box::new(|| { + | ^^ may outlive borrowed value `x` +... +LL | *x + | -- `x` is borrowed here + | +note: closure is returned here + --> $DIR/suggest-lt-on-ty-alias-w-generics.rs:4:5 + | +LL | / Box::new(|| { +LL | | +LL | | +LL | | *x +LL | | }) + | |______^ +help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword + | +LL | Box::new(move || { + | ++++ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0373`. From d5bc581f5db6ba5198ccec45d938422778f56bff Mon Sep 17 00:00:00 2001 From: clubby789 Date: Sun, 30 Apr 2023 02:20:53 +0100 Subject: [PATCH 07/97] Migrate `mir_transform` to translatable diagnostics --- Cargo.lock | 3 + compiler/rustc_driver_impl/Cargo.toml | 8 +- compiler/rustc_driver_impl/src/lib.rs | 1 + .../rustc_errors/src/diagnostic_builder.rs | 8 + compiler/rustc_mir_transform/Cargo.toml | 2 + compiler/rustc_mir_transform/messages.ftl | 66 +++++ .../src/check_const_item_mutation.rs | 65 ++--- .../src/check_packed_ref.rs | 23 +- .../rustc_mir_transform/src/check_unsafety.rs | 68 ++--- .../src/const_prop_lint.rs | 76 +++--- compiler/rustc_mir_transform/src/errors.rs | 245 ++++++++++++++++++ .../src/ffi_unwind_calls.rs | 16 +- .../src/function_item_references.rs | 33 +-- compiler/rustc_mir_transform/src/generator.rs | 38 +-- compiler/rustc_mir_transform/src/lib.rs | 8 + .../src/lower_intrinsics.rs | 10 +- 16 files changed, 470 insertions(+), 200 deletions(-) create mode 100644 compiler/rustc_mir_transform/messages.ftl create mode 100644 compiler/rustc_mir_transform/src/errors.rs diff --git a/Cargo.lock b/Cargo.lock index f6ee8157b40e..b6253f539bb6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3351,6 +3351,7 @@ dependencies = [ "rustc_middle", "rustc_mir_build", "rustc_mir_dataflow", + "rustc_mir_transform", "rustc_monomorphize", "rustc_parse", "rustc_passes", @@ -3859,8 +3860,10 @@ dependencies = [ "rustc_const_eval", "rustc_data_structures", "rustc_errors", + "rustc_fluent_macro", "rustc_hir", "rustc_index", + "rustc_macros", "rustc_middle", "rustc_mir_dataflow", "rustc_serialize", diff --git a/compiler/rustc_driver_impl/Cargo.toml b/compiler/rustc_driver_impl/Cargo.toml index cc4c5a0cacdd..d7d97fcc3e7b 100644 --- a/compiler/rustc_driver_impl/Cargo.toml +++ b/compiler/rustc_driver_impl/Cargo.toml @@ -51,6 +51,7 @@ rustc_interface = { path = "../rustc_interface" } rustc_ast = { path = "../rustc_ast" } rustc_span = { path = "../rustc_span" } rustc_hir_analysis = { path = "../rustc_hir_analysis" } +rustc_mir_transform = { path = "../rustc_mir_transform" } [target.'cfg(unix)'.dependencies] libc = "0.2" @@ -64,5 +65,8 @@ features = [ [features] llvm = ['rustc_interface/llvm'] max_level_info = ['rustc_log/max_level_info'] -rustc_use_parallel_compiler = ['rustc_data_structures/rustc_use_parallel_compiler', 'rustc_interface/rustc_use_parallel_compiler', - 'rustc_middle/rustc_use_parallel_compiler'] +rustc_use_parallel_compiler = [ + 'rustc_data_structures/rustc_use_parallel_compiler', + 'rustc_interface/rustc_use_parallel_compiler', + 'rustc_middle/rustc_use_parallel_compiler' +] diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 5fac485de641..c629c55264a1 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -99,6 +99,7 @@ pub static DEFAULT_LOCALE_RESOURCES: &[&str] = &[ rustc_middle::DEFAULT_LOCALE_RESOURCE, rustc_mir_build::DEFAULT_LOCALE_RESOURCE, rustc_mir_dataflow::DEFAULT_LOCALE_RESOURCE, + rustc_mir_transform::DEFAULT_LOCALE_RESOURCE, rustc_monomorphize::DEFAULT_LOCALE_RESOURCE, rustc_parse::DEFAULT_LOCALE_RESOURCE, rustc_passes::DEFAULT_LOCALE_RESOURCE, diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index 3064d2bedbe1..c8e57aa39af7 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -570,6 +570,14 @@ impl<'a, G: EmissionGuarantee> DiagnosticBuilder<'a, G> { Some((diagnostic, handler)) } + /// Retrieves the [`Handler`] if available + pub fn handler(&self) -> Option<&Handler> { + match self.inner.state { + DiagnosticBuilderState::Emittable(handler) => Some(handler), + DiagnosticBuilderState::AlreadyEmittedOrDuringCancellation => None, + } + } + /// Buffers the diagnostic for later emission, /// unless handler has disabled such buffering. pub fn buffer(self, buffered_diagnostics: &mut Vec) { diff --git a/compiler/rustc_mir_transform/Cargo.toml b/compiler/rustc_mir_transform/Cargo.toml index 962536669e0d..eca5f98a2c01 100644 --- a/compiler/rustc_mir_transform/Cargo.toml +++ b/compiler/rustc_mir_transform/Cargo.toml @@ -24,6 +24,8 @@ rustc_session = { path = "../rustc_session" } rustc_target = { path = "../rustc_target" } rustc_trait_selection = { path = "../rustc_trait_selection" } rustc_span = { path = "../rustc_span" } +rustc_fluent_macro = { path = "../rustc_fluent_macro" } +rustc_macros = { path = "../rustc_macros" } [dev-dependencies] coverage_test_macros = { path = "src/coverage/test_macros" } diff --git a/compiler/rustc_mir_transform/messages.ftl b/compiler/rustc_mir_transform/messages.ftl new file mode 100644 index 000000000000..8c85cb5f76d8 --- /dev/null +++ b/compiler/rustc_mir_transform/messages.ftl @@ -0,0 +1,66 @@ +mir_transform_const_modify = attempting to modify a `const` item + .note = each usage of a `const` item creates a new temporary; the original `const` item will not be modified + +mir_transform_const_mut_borrow = taking a mutable reference to a `const` item + .note = each usage of a `const` item creates a new temporary + .note2 = the mutable reference will refer to this temporary, not the original `const` item + .note3 = mutable reference created due to call to this method + +mir_transform_const_defined_here = `const` item defined here + +mir_transform_unaligned_packed_ref = reference to packed field is unaligned + .note = packed structs are only aligned by one byte, and many modern architectures penalize unaligned field accesses + .note_ub = creating a misaligned reference is undefined behavior (even if that reference is never dereferenced) + .help = copy the field contents to a local variable, or replace the reference with a raw pointer and use `read_unaligned`/`write_unaligned` (loads and stores via `*p` must be properly aligned even when using raw pointers) + +mir_transform_unused_unsafe = unnecessary `unsafe` block + .label = because it's nested under this `unsafe` block + +mir_transform_requires_unsafe = {$details} is unsafe and requires unsafe {$op_in_unsafe_fn_allowed -> + [true] function or block + *[false] block + } + .not_inherited = items do not inherit unsafety from separate enclosing items + +mir_transform_call_to_unsafe_label = call to unsafe function +mir_transform_call_to_unsafe_note = consult the function's documentation for information on how to avoid undefined behavior +mir_transform_use_of_asm_label = use of inline assembly +mir_transform_use_of_asm_note = inline assembly is entirely unchecked and can cause undefined behavior +mir_transform_initializing_valid_range_label = initializing type with `rustc_layout_scalar_valid_range` attr +mir_transform_initializing_valid_range_note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior +mir_transform_const_ptr2int_label = cast of pointer to int +mir_transform_const_ptr2int_note = casting pointers to integers in constants +mir_transform_use_of_static_mut_label = use of mutable static +mir_transform_use_of_static_mut_note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior +mir_transform_use_of_extern_static_label = use of extern static +mir_transform_use_of_extern_static_note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior +mir_transform_deref_ptr_label = dereference of raw pointer +mir_transform_deref_ptr_note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior +mir_transform_union_access_label = access to union field +mir_transform_union_access_note = the field may not be properly initialized: using uninitialized data will cause undefined behavior +mir_transform_mutation_layout_constrained_label = mutation of layout constrained field +mir_transform_mutation_layout_constrained_note = mutating layout constrained fields cannot statically be checked for valid values +mir_transform_mutation_layout_constrained_borrow_label = borrow of layout constrained field with interior mutability +mir_transform_mutation_layout_constrained_borrow_note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values +mir_transform_target_feature_call_label = call to function with `#[target_feature]` +mir_transform_target_feature_call_note = can only be called if the required target features are available + +mir_transform_unsafe_op_in_unsafe_fn = {$details} is unsafe and requires unsafe block (error E0133) + +mir_transform_arithmetic_overflow = this arithmetic operation will overflow +mir_transform_operation_will_panic = this operation will panic at runtime + +mir_transform_ffi_unwind_call = call to {$foreign -> + [true] foreign function + *[false] function pointer + } with FFI-unwind ABI + +mir_transform_fn_item_ref = taking a reference to a function item does not give a function pointer + .suggestion = cast `{$ident}` to obtain a function pointer + +mir_transform_must_not_suspend = {$pre}`{$def_path}`{$post} held across a suspend point, but should not be + .label = the value is held across this suspend point + .note = {$reason} + .help = consider using a block (`{"{ ... }"}`) to shrink the value's scope, ending before the suspend point + +mir_transform_simd_shuffle_last_const = last argument of `simd_shuffle` is required to be a `const` item diff --git a/compiler/rustc_mir_transform/src/check_const_item_mutation.rs b/compiler/rustc_mir_transform/src/check_const_item_mutation.rs index 57b24c9c552a..b79150737d61 100644 --- a/compiler/rustc_mir_transform/src/check_const_item_mutation.rs +++ b/compiler/rustc_mir_transform/src/check_const_item_mutation.rs @@ -1,11 +1,12 @@ -use rustc_errors::{DiagnosticBuilder, DiagnosticMessage}; +use rustc_hir::HirId; use rustc_middle::mir::visit::Visitor; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; use rustc_session::lint::builtin::CONST_ITEM_MUTATION; use rustc_span::def_id::DefId; +use rustc_span::Span; -use crate::MirLint; +use crate::{errors, MirLint}; pub struct CheckConstItemMutation; @@ -58,16 +59,14 @@ impl<'tcx> ConstMutationChecker<'_, 'tcx> { } } - fn lint_const_item_usage( + /// If we should lint on this usage, return the [`HirId`], source [`Span`] + /// and [`Span`] of the const item to use in the lint. + fn should_lint_const_item_usage( &self, place: &Place<'tcx>, const_item: DefId, location: Location, - msg: impl Into, - decorate: impl for<'a, 'b> FnOnce( - &'a mut DiagnosticBuilder<'b, ()>, - ) -> &'a mut DiagnosticBuilder<'b, ()>, - ) { + ) -> Option<(HirId, Span, Span)> { // Don't lint on borrowing/assigning when a dereference is involved. // If we 'leave' the temporary via a dereference, we must // be modifying something else @@ -83,16 +82,9 @@ impl<'tcx> ConstMutationChecker<'_, 'tcx> { .assert_crate_local() .lint_root; - self.tcx.struct_span_lint_hir( - CONST_ITEM_MUTATION, - lint_root, - source_info.span, - msg, - |lint| { - decorate(lint) - .span_note(self.tcx.def_span(const_item), "`const` item defined here") - }, - ); + Some((lint_root, source_info.span, self.tcx.def_span(const_item))) + } else { + None } } } @@ -104,10 +96,14 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> { // Assigning directly to a constant (e.g. `FOO = true;`) is a hard error, // so emitting a lint would be redundant. if !lhs.projection.is_empty() { - if let Some(def_id) = self.is_const_item_without_destructor(lhs.local) { - self.lint_const_item_usage(&lhs, def_id, loc, "attempting to modify a `const` item",|lint| { - lint.note("each usage of a `const` item creates a new temporary; the original `const` item will not be modified") - }) + if let Some(def_id) = self.is_const_item_without_destructor(lhs.local) + && let Some((lint_root, span, item)) = self.should_lint_const_item_usage(&lhs, def_id, loc) { + self.tcx.emit_spanned_lint( + CONST_ITEM_MUTATION, + lint_root, + span, + errors::ConstMutate::Modify { konst: item } + ); } } // We are looking for MIR of the form: @@ -143,17 +139,22 @@ impl<'tcx> Visitor<'tcx> for ConstMutationChecker<'_, 'tcx> { }); let lint_loc = if method_did.is_some() { self.body.terminator_loc(loc.block) } else { loc }; - self.lint_const_item_usage(place, def_id, lint_loc, "taking a mutable reference to a `const` item", |lint| { - lint - .note("each usage of a `const` item creates a new temporary") - .note("the mutable reference will refer to this temporary, not the original `const` item"); - if let Some((method_did, _substs)) = method_did { - lint.span_note(self.tcx.def_span(method_did), "mutable reference created due to call to this method"); - } - - lint - }); + let method_call = if let Some((method_did, _)) = method_did { + Some(self.tcx.def_span(method_did)) + } else { + None + }; + if let Some((lint_root, span, item)) = + self.should_lint_const_item_usage(place, def_id, lint_loc) + { + self.tcx.emit_spanned_lint( + CONST_ITEM_MUTATION, + lint_root, + span, + errors::ConstMutate::MutBorrow { method_call, konst: item }, + ); + } } } self.super_rvalue(rvalue, loc); diff --git a/compiler/rustc_mir_transform/src/check_packed_ref.rs b/compiler/rustc_mir_transform/src/check_packed_ref.rs index b9bc89fcf8fa..2e6cf603d596 100644 --- a/compiler/rustc_mir_transform/src/check_packed_ref.rs +++ b/compiler/rustc_mir_transform/src/check_packed_ref.rs @@ -1,10 +1,9 @@ -use rustc_errors::struct_span_err; use rustc_middle::mir::visit::{PlaceContext, Visitor}; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; -use crate::util; use crate::MirLint; +use crate::{errors, util}; pub struct CheckPackedRef; @@ -49,25 +48,7 @@ impl<'tcx> Visitor<'tcx> for PackedRefChecker<'_, 'tcx> { // shouldn't do. span_bug!(self.source_info.span, "builtin derive created an unaligned reference"); } else { - struct_span_err!( - self.tcx.sess, - self.source_info.span, - E0793, - "reference to packed field is unaligned" - ) - .note( - "packed structs are only aligned by one byte, and many modern architectures \ - penalize unaligned field accesses" - ) - .note( - "creating a misaligned reference is undefined behavior (even if that \ - reference is never dereferenced)", - ).help( - "copy the field contents to a local variable, or replace the \ - reference with a raw pointer and use `read_unaligned`/`write_unaligned` \ - (loads and stores via `*p` must be properly aligned even when using raw pointers)" - ) - .emit(); + self.tcx.sess.emit_err(errors::UnalignedPackedRef { span: self.source_info.span }); } } } diff --git a/compiler/rustc_mir_transform/src/check_unsafety.rs b/compiler/rustc_mir_transform/src/check_unsafety.rs index ce6d865a7dce..bdb4f20da105 100644 --- a/compiler/rustc_mir_transform/src/check_unsafety.rs +++ b/compiler/rustc_mir_transform/src/check_unsafety.rs @@ -1,5 +1,4 @@ use rustc_data_structures::unord::{UnordItems, UnordSet}; -use rustc_errors::struct_span_err; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::{DefId, LocalDefId}; @@ -15,6 +14,8 @@ use rustc_session::lint::Level; use std::ops::Bound; +use crate::errors; + pub struct UnsafetyChecker<'a, 'tcx> { body: &'a Body<'tcx>, body_did: LocalDefId, @@ -509,21 +510,12 @@ fn unsafety_check_result(tcx: TyCtxt<'_>, def: LocalDefId) -> &UnsafetyCheckResu fn report_unused_unsafe(tcx: TyCtxt<'_>, kind: UnusedUnsafe, id: HirId) { let span = tcx.sess.source_map().guess_head_span(tcx.hir().span(id)); - let msg = "unnecessary `unsafe` block"; - tcx.struct_span_lint_hir(UNUSED_UNSAFE, id, span, msg, |lint| { - lint.span_label(span, msg); - match kind { - UnusedUnsafe::Unused => {} - UnusedUnsafe::InUnsafeBlock(id) => { - lint.span_label( - tcx.sess.source_map().guess_head_span(tcx.hir().span(id)), - "because it's nested under this `unsafe` block", - ); - } - } - - lint - }); + let nested_parent = if let UnusedUnsafe::InUnsafeBlock(id) = kind { + Some(tcx.sess.source_map().guess_head_span(tcx.hir().span(id))) + } else { + None + }; + tcx.emit_spanned_lint(UNUSED_UNSAFE, id, span, errors::UnusedUnsafe { span, nested_parent }); } pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) { @@ -537,26 +529,11 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) { let UnsafetyCheckResult { violations, unused_unsafes, .. } = tcx.unsafety_check_result(def_id); for &UnsafetyViolation { source_info, lint_root, kind, details } in violations.iter() { - let (description, note) = details.description_and_note(); + let details = errors::RequiresUnsafeDetail { violation: details, span: source_info.span }; match kind { UnsafetyViolationKind::General => { - // once - let unsafe_fn_msg = if unsafe_op_in_unsafe_fn_allowed(tcx, lint_root) { - " function or" - } else { - "" - }; - - let mut err = struct_span_err!( - tcx.sess, - source_info.span, - E0133, - "{} is unsafe and requires unsafe{} block", - description, - unsafe_fn_msg, - ); - err.span_label(source_info.span, description).note(note); + let op_in_unsafe_fn_allowed = unsafe_op_in_unsafe_fn_allowed(tcx, lint_root); let note_non_inherited = tcx.hir().parent_iter(lint_root).find(|(id, node)| { if let Node::Expr(block) = node && let ExprKind::Block(block, _) = block.kind @@ -572,22 +549,23 @@ pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: LocalDefId) { false } }); - if let Some((id, _)) = note_non_inherited { - let span = tcx.hir().span(id); - err.span_label( - tcx.sess.source_map().guess_head_span(span), - "items do not inherit unsafety from separate enclosing items", - ); - } - - err.emit(); + let enclosing = if let Some((id, _)) = note_non_inherited { + Some(tcx.sess.source_map().guess_head_span(tcx.hir().span(id))) + } else { + None + }; + tcx.sess.emit_err(errors::RequiresUnsafe { + span: source_info.span, + enclosing, + details, + op_in_unsafe_fn_allowed, + }); } - UnsafetyViolationKind::UnsafeFn => tcx.struct_span_lint_hir( + UnsafetyViolationKind::UnsafeFn => tcx.emit_spanned_lint( UNSAFE_OP_IN_UNSAFE_FN, lint_root, source_info.span, - format!("{} is unsafe and requires unsafe block (error E0133)", description,), - |lint| lint.span_label(source_info.span, description).note(note), + errors::UnsafeOpInUnsafeFn { details }, ), } } diff --git a/compiler/rustc_mir_transform/src/const_prop_lint.rs b/compiler/rustc_mir_transform/src/const_prop_lint.rs index a4049d08d7b8..adb09c509d28 100644 --- a/compiler/rustc_mir_transform/src/const_prop_lint.rs +++ b/compiler/rustc_mir_transform/src/const_prop_lint.rs @@ -1,6 +1,8 @@ //! Propagates constants for early reporting of statically known //! assertion failures +use std::fmt::Debug; + use either::Left; use rustc_const_eval::interpret::Immediate; @@ -17,7 +19,6 @@ use rustc_middle::ty::InternalSubsts; use rustc_middle::ty::{ self, ConstInt, Instance, ParamEnv, ScalarInt, Ty, TyCtxt, TypeVisitableExt, }; -use rustc_session::lint; use rustc_span::Span; use rustc_target::abi::{HasDataLayout, Size, TargetDataLayout}; use rustc_trait_selection::traits; @@ -25,6 +26,7 @@ use rustc_trait_selection::traits; use crate::const_prop::CanConstProp; use crate::const_prop::ConstPropMachine; use crate::const_prop::ConstPropMode; +use crate::errors::AssertLint; use crate::MirLint; /// The maximum number of bytes that we'll allocate space for a local or the return value. @@ -311,18 +313,9 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { } } - fn report_assert_as_lint( - &self, - lint: &'static lint::Lint, - location: Location, - message: &'static str, - panic: AssertKind, - ) { - let source_info = self.body().source_info(location); + fn report_assert_as_lint(&self, source_info: &SourceInfo, lint: AssertLint) { if let Some(lint_root) = self.lint_root(*source_info) { - self.tcx.struct_span_lint_hir(lint, lint_root, source_info.span, message, |lint| { - lint.span_label(source_info.span, format!("{:?}", panic)) - }); + self.tcx.emit_spanned_lint(lint.lint(), lint_root, source_info.span, lint); } } @@ -335,11 +328,13 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { // `AssertKind` only has an `OverflowNeg` variant, so make sure that is // appropriate to use. assert_eq!(op, UnOp::Neg, "Neg is the only UnOp that can overflow"); + let source_info = self.body().source_info(location); self.report_assert_as_lint( - lint::builtin::ARITHMETIC_OVERFLOW, - location, - "this arithmetic operation will overflow", - AssertKind::OverflowNeg(val.to_const_int()), + source_info, + AssertLint::ArithmeticOverflow( + source_info.span, + AssertKind::OverflowNeg(val.to_const_int()), + ), ); return None; } @@ -370,23 +365,23 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { let r_bits = r.to_scalar().to_bits(right_size).ok(); if r_bits.map_or(false, |b| b >= left_size.bits() as u128) { debug!("check_binary_op: reporting assert for {:?}", location); + let source_info = self.body().source_info(location); + let panic = AssertKind::Overflow( + op, + match l { + Some(l) => l.to_const_int(), + // Invent a dummy value, the diagnostic ignores it anyway + None => ConstInt::new( + ScalarInt::try_from_uint(1_u8, left_size).unwrap(), + left_ty.is_signed(), + left_ty.is_ptr_sized_integral(), + ), + }, + r.to_const_int(), + ); self.report_assert_as_lint( - lint::builtin::ARITHMETIC_OVERFLOW, - location, - "this arithmetic operation will overflow", - AssertKind::Overflow( - op, - match l { - Some(l) => l.to_const_int(), - // Invent a dummy value, the diagnostic ignores it anyway - None => ConstInt::new( - ScalarInt::try_from_uint(1_u8, left_size).unwrap(), - left_ty.is_signed(), - left_ty.is_ptr_sized_integral(), - ), - }, - r.to_const_int(), - ), + source_info, + AssertLint::ArithmeticOverflow(source_info.span, panic), ); return None; } @@ -398,11 +393,13 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { let (_res, overflow, _ty) = this.ecx.overflowing_binary_op(op, &l, &r)?; Ok(overflow) })? { + let source_info = self.body().source_info(location); self.report_assert_as_lint( - lint::builtin::ARITHMETIC_OVERFLOW, - location, - "this arithmetic operation will overflow", - AssertKind::Overflow(op, l.to_const_int(), r.to_const_int()), + source_info, + AssertLint::ArithmeticOverflow( + source_info.span, + AssertKind::Overflow(op, l.to_const_int(), r.to_const_int()), + ), ); return None; } @@ -543,11 +540,10 @@ impl<'mir, 'tcx> ConstPropagator<'mir, 'tcx> { // Need proper const propagator for these. _ => return None, }; + let source_info = self.body().source_info(location); self.report_assert_as_lint( - lint::builtin::UNCONDITIONAL_PANIC, - location, - "this operation will panic at runtime", - msg, + source_info, + AssertLint::UnconditionalPanic(source_info.span, msg), ); } diff --git a/compiler/rustc_mir_transform/src/errors.rs b/compiler/rustc_mir_transform/src/errors.rs new file mode 100644 index 000000000000..602e40d51310 --- /dev/null +++ b/compiler/rustc_mir_transform/src/errors.rs @@ -0,0 +1,245 @@ +use rustc_errors::{ + DecorateLint, DiagnosticBuilder, DiagnosticMessage, EmissionGuarantee, Handler, IntoDiagnostic, +}; +use rustc_macros::{Diagnostic, LintDiagnostic, Subdiagnostic}; +use rustc_middle::mir::{AssertKind, UnsafetyViolationDetails}; +use rustc_session::lint::{self, Lint}; +use rustc_span::Span; + +#[derive(LintDiagnostic)] +pub(crate) enum ConstMutate { + #[diag(mir_transform_const_modify)] + #[note] + Modify { + #[note(mir_transform_const_defined_here)] + konst: Span, + }, + #[diag(mir_transform_const_mut_borrow)] + #[note] + #[note(mir_transform_note2)] + MutBorrow { + #[note(mir_transform_note3)] + method_call: Option, + #[note(mir_transform_const_defined_here)] + konst: Span, + }, +} + +#[derive(Diagnostic)] +#[diag(mir_transform_unaligned_packed_ref, code = "E0793")] +#[note] +#[note(mir_transform_note_ub)] +#[help] +pub(crate) struct UnalignedPackedRef { + #[primary_span] + pub span: Span, +} + +#[derive(LintDiagnostic)] +#[diag(mir_transform_unused_unsafe)] +pub(crate) struct UnusedUnsafe { + #[label(mir_transform_unused_unsafe)] + pub span: Span, + #[label] + pub nested_parent: Option, +} + +pub(crate) struct RequiresUnsafe { + pub span: Span, + pub details: RequiresUnsafeDetail, + pub enclosing: Option, + pub op_in_unsafe_fn_allowed: bool, +} + +// The primary message for this diagnostic should be '{$label} is unsafe and...', +// so we need to eagerly translate the label here, which isn't supported by the derive API +// We could also exhaustively list out the primary messages for all unsafe violations, +// but this would result in a lot of duplication. +impl<'sess, G: EmissionGuarantee> IntoDiagnostic<'sess, G> for RequiresUnsafe { + #[track_caller] + fn into_diagnostic(self, handler: &'sess Handler) -> DiagnosticBuilder<'sess, G> { + let mut diag = + handler.struct_diagnostic(crate::fluent_generated::mir_transform_requires_unsafe); + diag.code(rustc_errors::DiagnosticId::Error("E0133".to_string())); + diag.set_span(self.span); + diag.span_label(self.span, self.details.label()); + diag.note(self.details.note()); + let desc = handler.eagerly_translate_to_string(self.details.label(), [].into_iter()); + diag.set_arg("details", desc); + diag.set_arg("op_in_unsafe_fn_allowed", self.op_in_unsafe_fn_allowed); + if let Some(sp) = self.enclosing { + diag.span_label(sp, crate::fluent_generated::mir_transform_not_inherited); + } + diag + } +} + +#[derive(Copy, Clone)] +pub(crate) struct RequiresUnsafeDetail { + pub span: Span, + pub violation: UnsafetyViolationDetails, +} + +impl RequiresUnsafeDetail { + fn note(self) -> DiagnosticMessage { + use UnsafetyViolationDetails::*; + match self.violation { + CallToUnsafeFunction => crate::fluent_generated::mir_transform_call_to_unsafe_note, + UseOfInlineAssembly => crate::fluent_generated::mir_transform_use_of_asm_note, + InitializingTypeWith => { + crate::fluent_generated::mir_transform_initializing_valid_range_note + } + CastOfPointerToInt => crate::fluent_generated::mir_transform_const_ptr2int_note, + UseOfMutableStatic => crate::fluent_generated::mir_transform_use_of_static_mut_note, + UseOfExternStatic => crate::fluent_generated::mir_transform_use_of_extern_static_note, + DerefOfRawPointer => crate::fluent_generated::mir_transform_deref_ptr_note, + AccessToUnionField => crate::fluent_generated::mir_transform_union_access_note, + MutationOfLayoutConstrainedField => { + crate::fluent_generated::mir_transform_mutation_layout_constrained_note + } + BorrowOfLayoutConstrainedField => { + crate::fluent_generated::mir_transform_mutation_layout_constrained_borrow_note + } + CallToFunctionWith => crate::fluent_generated::mir_transform_target_feature_call_note, + } + } + + fn label(self) -> DiagnosticMessage { + use UnsafetyViolationDetails::*; + match self.violation { + CallToUnsafeFunction => crate::fluent_generated::mir_transform_call_to_unsafe_label, + UseOfInlineAssembly => crate::fluent_generated::mir_transform_use_of_asm_label, + InitializingTypeWith => { + crate::fluent_generated::mir_transform_initializing_valid_range_label + } + CastOfPointerToInt => crate::fluent_generated::mir_transform_const_ptr2int_label, + UseOfMutableStatic => crate::fluent_generated::mir_transform_use_of_static_mut_label, + UseOfExternStatic => crate::fluent_generated::mir_transform_use_of_extern_static_label, + DerefOfRawPointer => crate::fluent_generated::mir_transform_deref_ptr_label, + AccessToUnionField => crate::fluent_generated::mir_transform_union_access_label, + MutationOfLayoutConstrainedField => { + crate::fluent_generated::mir_transform_mutation_layout_constrained_label + } + BorrowOfLayoutConstrainedField => { + crate::fluent_generated::mir_transform_mutation_layout_constrained_borrow_label + } + CallToFunctionWith => crate::fluent_generated::mir_transform_target_feature_call_label, + } + } +} + +pub(crate) struct UnsafeOpInUnsafeFn { + pub details: RequiresUnsafeDetail, +} + +impl<'a> DecorateLint<'a, ()> for UnsafeOpInUnsafeFn { + #[track_caller] + fn decorate_lint<'b>( + self, + diag: &'b mut DiagnosticBuilder<'a, ()>, + ) -> &'b mut DiagnosticBuilder<'a, ()> { + let desc = diag + .handler() + .expect("lint should not yet be emitted") + .eagerly_translate_to_string(self.details.label(), [].into_iter()); + diag.set_arg("details", desc); + diag.span_label(self.details.span, self.details.label()); + diag.note(self.details.note()); + diag + } + + fn msg(&self) -> DiagnosticMessage { + crate::fluent_generated::mir_transform_unsafe_op_in_unsafe_fn + } +} + +pub(crate) enum AssertLint

{ + ArithmeticOverflow(Span, AssertKind

), + UnconditionalPanic(Span, AssertKind

), +} + +impl<'a, P: std::fmt::Debug> DecorateLint<'a, ()> for AssertLint

{ + fn decorate_lint<'b>( + self, + diag: &'b mut DiagnosticBuilder<'a, ()>, + ) -> &'b mut DiagnosticBuilder<'a, ()> { + diag.span_label(self.span(), format!("{:?}", self.panic())); + diag + } + + fn msg(&self) -> DiagnosticMessage { + match self { + AssertLint::ArithmeticOverflow(..) => { + crate::fluent_generated::mir_transform_arithmetic_overflow + } + AssertLint::UnconditionalPanic(..) => { + crate::fluent_generated::mir_transform_operation_will_panic + } + } + } +} + +impl

AssertLint

{ + pub fn lint(&self) -> &'static Lint { + match self { + AssertLint::ArithmeticOverflow(..) => lint::builtin::ARITHMETIC_OVERFLOW, + AssertLint::UnconditionalPanic(..) => lint::builtin::UNCONDITIONAL_PANIC, + } + } + pub fn span(&self) -> Span { + match self { + AssertLint::ArithmeticOverflow(sp, _) | AssertLint::UnconditionalPanic(sp, _) => *sp, + } + } + pub fn panic(&self) -> &AssertKind

{ + match self { + AssertLint::ArithmeticOverflow(_, p) | AssertLint::UnconditionalPanic(_, p) => p, + } + } +} + +#[derive(LintDiagnostic)] +#[diag(mir_transform_ffi_unwind_call)] +pub(crate) struct FfiUnwindCall { + #[label(mir_transform_ffi_unwind_call)] + pub span: Span, + pub foreign: bool, +} + +#[derive(LintDiagnostic)] +#[diag(mir_transform_fn_item_ref)] +pub(crate) struct FnItemRef { + #[suggestion(code = "{sugg}", applicability = "unspecified")] + pub span: Span, + pub sugg: String, + pub ident: String, +} + +#[derive(LintDiagnostic)] +#[diag(mir_transform_must_not_suspend)] +pub(crate) struct MustNotSupend<'a> { + #[label] + pub yield_sp: Span, + #[subdiagnostic] + pub reason: Option, + #[help] + pub src_sp: Span, + pub pre: &'a str, + pub def_path: String, + pub post: &'a str, +} + +#[derive(Subdiagnostic)] +#[note(mir_transform_note)] +pub(crate) struct MustNotSuspendReason { + #[primary_span] + pub span: Span, + pub reason: String, +} + +#[derive(Diagnostic)] +#[diag(mir_transform_simd_shuffle_last_const)] +pub(crate) struct SimdShuffleLastConst { + #[primary_span] + pub span: Span, +} diff --git a/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs b/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs index db68adc8bc97..ac1de989a720 100644 --- a/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs +++ b/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs @@ -8,6 +8,8 @@ use rustc_session::lint::builtin::FFI_UNWIND_CALLS; use rustc_target::spec::abi::Abi; use rustc_target::spec::PanicStrategy; +use crate::errors; + fn abi_can_unwind(abi: Abi) -> bool { use Abi::*; match abi { @@ -107,13 +109,13 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool { .lint_root; let span = terminator.source_info.span; - let msg = match fn_def_id { - Some(_) => "call to foreign function with FFI-unwind ABI", - None => "call to function pointer with FFI-unwind ABI", - }; - tcx.struct_span_lint_hir(FFI_UNWIND_CALLS, lint_root, span, msg, |lint| { - lint.span_label(span, msg) - }); + let foreign = fn_def_id.is_some(); + tcx.emit_spanned_lint( + FFI_UNWIND_CALLS, + lint_root, + span, + errors::FfiUnwindCall { span, foreign }, + ); tainted = true; } diff --git a/compiler/rustc_mir_transform/src/function_item_references.rs b/compiler/rustc_mir_transform/src/function_item_references.rs index f26c6de9648c..5989dbebf2db 100644 --- a/compiler/rustc_mir_transform/src/function_item_references.rs +++ b/compiler/rustc_mir_transform/src/function_item_references.rs @@ -1,5 +1,4 @@ use itertools::Itertools; -use rustc_errors::Applicability; use rustc_hir::def_id::DefId; use rustc_middle::mir::visit::Visitor; use rustc_middle::mir::*; @@ -8,7 +7,7 @@ use rustc_session::lint::builtin::FUNCTION_ITEM_REFERENCES; use rustc_span::{symbol::sym, Span}; use rustc_target::spec::abi::Abi; -use crate::MirLint; +use crate::{errors, MirLint}; pub struct FunctionItemReferences; @@ -174,27 +173,21 @@ impl<'tcx> FunctionItemRefChecker<'_, 'tcx> { let num_args = fn_sig.inputs().map_bound(|inputs| inputs.len()).skip_binder(); let variadic = if fn_sig.c_variadic() { ", ..." } else { "" }; let ret = if fn_sig.output().skip_binder().is_unit() { "" } else { " -> _" }; - self.tcx.struct_span_lint_hir( + let sugg = format!( + "{} as {}{}fn({}{}){}", + if params.is_empty() { ident.clone() } else { format!("{}::<{}>", ident, params) }, + unsafety, + abi, + vec!["_"; num_args].join(", "), + variadic, + ret, + ); + + self.tcx.emit_spanned_lint( FUNCTION_ITEM_REFERENCES, lint_root, span, - "taking a reference to a function item does not give a function pointer", - |lint| { - lint.span_suggestion( - span, - format!("cast `{}` to obtain a function pointer", ident), - format!( - "{} as {}{}fn({}{}){}", - if params.is_empty() { ident } else { format!("{}::<{}>", ident, params) }, - unsafety, - abi, - vec!["_"; num_args].join(", "), - variadic, - ret, - ), - Applicability::Unspecified, - ) - }, + errors::FnItemRef { span, sugg, ident }, ); } } diff --git a/compiler/rustc_mir_transform/src/generator.rs b/compiler/rustc_mir_transform/src/generator.rs index e44dd084b2de..719a4f349cbf 100644 --- a/compiler/rustc_mir_transform/src/generator.rs +++ b/compiler/rustc_mir_transform/src/generator.rs @@ -51,6 +51,7 @@ //! Otherwise it drops all the values in scope at the last suspension point. use crate::deref_separator::deref_finder; +use crate::errors; use crate::simplify; use crate::MirPass; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; @@ -1892,36 +1893,21 @@ fn check_must_not_suspend_def( data: SuspendCheckData<'_>, ) -> bool { if let Some(attr) = tcx.get_attr(def_id, sym::must_not_suspend) { - let msg = rustc_errors::DelayDm(|| { - format!( - "{}`{}`{} held across a suspend point, but should not be", - data.descr_pre, - tcx.def_path_str(def_id), - data.descr_post, - ) + let reason = attr.value_str().map(|s| errors::MustNotSuspendReason { + span: data.source_span, + reason: s.as_str().to_string(), }); - tcx.struct_span_lint_hir( + tcx.emit_spanned_lint( rustc_session::lint::builtin::MUST_NOT_SUSPEND, hir_id, data.source_span, - msg, - |lint| { - // add span pointing to the offending yield/await - lint.span_label(data.yield_span, "the value is held across this suspend point"); - - // Add optional reason note - if let Some(note) = attr.value_str() { - // FIXME(guswynn): consider formatting this better - lint.span_note(data.source_span, note.as_str()); - } - - // Add some quick suggestions on what to do - // FIXME: can `drop` work as a suggestion here as well? - lint.span_help( - data.source_span, - "consider using a block (`{ ... }`) \ - to shrink the value's scope, ending before the suspend point", - ) + errors::MustNotSupend { + yield_sp: data.yield_span, + reason, + src_sp: data.source_span, + pre: data.descr_pre, + def_path: tcx.def_path_str(def_id), + post: data.descr_post, }, ); diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 25d7db0ee605..bcaebad543b2 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -1,4 +1,6 @@ #![allow(rustc::potential_query_instability)] +#![deny(rustc::untranslatable_diagnostic)] +#![deny(rustc::diagnostic_outside_of_impl)] #![feature(box_patterns)] #![feature(drain_filter)] #![feature(let_chains)] @@ -69,6 +71,7 @@ pub mod dump_mir; mod early_otherwise_branch; mod elaborate_box_derefs; mod elaborate_drops; +mod errors; mod ffi_unwind_calls; mod function_item_references; mod generator; @@ -105,6 +108,11 @@ use rustc_const_eval::transform::promote_consts; use rustc_const_eval::transform::validate; use rustc_mir_dataflow::rustc_peek; +use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; +use rustc_fluent_macro::fluent_messages; + +fluent_messages! { "../messages.ftl" } + pub fn provide(providers: &mut Providers) { check_unsafety::provide(providers); coverage::query::provide(providers); diff --git a/compiler/rustc_mir_transform/src/lower_intrinsics.rs b/compiler/rustc_mir_transform/src/lower_intrinsics.rs index 62b727674c5d..e95f60718ef9 100644 --- a/compiler/rustc_mir_transform/src/lower_intrinsics.rs +++ b/compiler/rustc_mir_transform/src/lower_intrinsics.rs @@ -1,6 +1,6 @@ //! Lowers intrinsic calls -use crate::MirPass; +use crate::{errors, MirPass}; use rustc_middle::mir::*; use rustc_middle::ty::subst::SubstsRef; use rustc_middle::ty::{self, Ty, TyCtxt}; @@ -287,11 +287,7 @@ fn resolve_rust_intrinsic<'tcx>( } fn validate_simd_shuffle<'tcx>(tcx: TyCtxt<'tcx>, args: &[Operand<'tcx>], span: Span) { - match &args[2] { - Operand::Constant(_) => {} // all good - _ => { - let msg = "last argument of `simd_shuffle` is required to be a `const` item"; - tcx.sess.span_err(span, msg); - } + if !matches!(args[2], Operand::Constant(_)) { + tcx.sess.emit_err(errors::SimdShuffleLastConst { span }); } } From 4cab0dce2f27742823b1604d61e4500ad09c8393 Mon Sep 17 00:00:00 2001 From: Kisaragi Marine Date: Thu, 4 May 2023 13:52:21 +0900 Subject: [PATCH 08/97] stdarch: update submodule, take 4 --- library/stdarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/stdarch b/library/stdarch index 313a8bd2b7ee..461aad2bb662 160000 --- a/library/stdarch +++ b/library/stdarch @@ -1 +1 @@ -Subproject commit 313a8bd2b7ee5a758afde790cabd6f7717490bcd +Subproject commit 461aad2bb66270c3b49bbcb1a753fa1d0dffac26 From e8139dfd5a747842a8303f33d8c842378913d594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Tue, 21 Mar 2023 01:46:52 +0100 Subject: [PATCH 09/97] IAT: Introduce AliasKind::Inherent --- .../rustc_hir_analysis/src/astconv/mod.rs | 61 ++++---- .../src/coherence/orphan.rs | 13 ++ .../src/collect/resolve_bound_vars.rs | 2 +- .../rustc_hir_analysis/src/collect/type_of.rs | 2 +- .../src/constrained_generic_params.rs | 2 +- .../src/outlives/implicit_infer.rs | 3 + .../src/fn_ctxt/adjust_fulfillment_errors.rs | 2 +- compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs | 2 +- .../rustc_hir_typeck/src/method/suggest.rs | 2 +- compiler/rustc_infer/src/infer/combine.rs | 3 +- .../src/infer/error_reporting/mod.rs | 4 +- .../infer/error_reporting/note_and_explain.rs | 7 +- .../rustc_infer/src/infer/opaque_types.rs | 2 + compiler/rustc_lint/src/builtin.rs | 7 +- compiler/rustc_lint/src/types.rs | 4 +- compiler/rustc_middle/src/query/mod.rs | 10 ++ compiler/rustc_middle/src/ty/context.rs | 14 +- compiler/rustc_middle/src/ty/error.rs | 4 +- compiler/rustc_middle/src/ty/flags.rs | 14 +- .../rustc_middle/src/ty/inhabitedness/mod.rs | 6 + compiler/rustc_middle/src/ty/layout.rs | 2 +- compiler/rustc_middle/src/ty/mod.rs | 2 +- compiler/rustc_middle/src/ty/print/pretty.rs | 2 +- compiler/rustc_middle/src/ty/relate.rs | 5 + compiler/rustc_middle/src/ty/sty.rs | 51 +++++-- compiler/rustc_middle/src/ty/visit.rs | 3 + compiler/rustc_privacy/src/lib.rs | 33 ++++ compiler/rustc_trait_selection/messages.ftl | 2 + compiler/rustc_trait_selection/src/errors.rs | 8 + .../src/solve/assembly/structural_traits.rs | 2 +- .../src/solve/trait_goals.rs | 2 +- .../src/traits/coherence.rs | 2 +- .../src/traits/error_reporting/mod.rs | 15 +- .../rustc_trait_selection/src/traits/mod.rs | 3 +- .../src/traits/project.rs | 143 +++++++++++++++++- .../src/traits/query/normalize.rs | 17 ++- .../src/traits/select/candidate_assembly.rs | 2 +- .../src/traits/select/confirmation.rs | 2 +- .../src/traits/select/mod.rs | 2 +- .../rustc_trait_selection/src/traits/wf.rs | 3 + compiler/rustc_traits/src/chalk/lowering.rs | 1 + .../src/normalize_projection_ty.rs | 29 +++- compiler/rustc_type_ir/src/lib.rs | 27 ++-- compiler/rustc_type_ir/src/sty.rs | 1 + src/librustdoc/clean/mod.rs | 4 + .../clippy/clippy_lints/src/dereference.rs | 1 + tests/rustdoc/inherent-projections.rs | 14 ++ .../bugs/cycle-iat-inside-of-adt.rs | 10 ++ .../bugs/cycle-iat-inside-of-adt.stderr | 49 ++++++ .../cycle-iat-inside-of-where-predicate.rs | 16 ++ ...cycle-iat-inside-of-where-predicate.stderr | 37 +++++ .../bugs/ice-substitution.rs | 23 --- .../bugs/ice-substitution.stderr | 6 - .../bugs/inference-fail.rs | 15 -- .../bugs/lack-of-regionck.rs | 19 --- .../bugs/wf-check-skipped.rs | 15 ++ .../dispatch-on-self-type-0.rs | 2 +- .../former-subst-ice.rs | 16 ++ .../generic-associated-types-bad.item.stderr | 15 ++ .../generic-associated-types-bad.local.stderr | 15 ++ ...generic-associated-types-bad.region.stderr | 11 ++ .../generic-associated-types-bad.rs | 26 ++++ .../inference-fail.rs | 11 ++ .../{bugs => }/inference-fail.stderr | 6 +- .../ui/associated-inherent-types/inference.rs | 39 +++++ .../late-bound-regions.rs | 25 +++ .../late-bound-regions.stderr | 12 ++ .../normalization-overflow.rs | 12 ++ .../normalization-overflow.stderr | 8 + .../private-in-public.rs | 26 ++++ .../private-in-public.stderr | 34 +++++ .../associated-inherent-types/regionck-0.rs | 14 ++ .../regionck-0.stderr | 10 ++ .../associated-inherent-types/regionck-1.rs | 13 ++ .../regionck-1.stderr | 29 ++++ .../associated-inherent-types/regionck-2.rs | 14 ++ .../regionck-2.stderr | 18 +++ .../type-alias-bounds-are-enforced.rs | 26 ++++ .../unsatisfied-bounds-inferred-type.rs | 12 ++ .../unsatisfied-bounds-inferred-type.stderr | 17 +++ ...tisfied-bounds-where-clause-on-assoc-ty.rs | 14 ++ ...ied-bounds-where-clause-on-assoc-ty.stderr | 18 +++ 82 files changed, 1008 insertions(+), 167 deletions(-) create mode 100644 tests/rustdoc/inherent-projections.rs create mode 100644 tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs create mode 100644 tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr create mode 100644 tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs create mode 100644 tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr delete mode 100644 tests/ui/associated-inherent-types/bugs/ice-substitution.rs delete mode 100644 tests/ui/associated-inherent-types/bugs/ice-substitution.stderr delete mode 100644 tests/ui/associated-inherent-types/bugs/inference-fail.rs delete mode 100644 tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs create mode 100644 tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs create mode 100644 tests/ui/associated-inherent-types/former-subst-ice.rs create mode 100644 tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr create mode 100644 tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr create mode 100644 tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr create mode 100644 tests/ui/associated-inherent-types/generic-associated-types-bad.rs create mode 100644 tests/ui/associated-inherent-types/inference-fail.rs rename tests/ui/associated-inherent-types/{bugs => }/inference-fail.stderr (53%) create mode 100644 tests/ui/associated-inherent-types/inference.rs create mode 100644 tests/ui/associated-inherent-types/late-bound-regions.rs create mode 100644 tests/ui/associated-inherent-types/late-bound-regions.stderr create mode 100644 tests/ui/associated-inherent-types/normalization-overflow.rs create mode 100644 tests/ui/associated-inherent-types/normalization-overflow.stderr create mode 100644 tests/ui/associated-inherent-types/private-in-public.rs create mode 100644 tests/ui/associated-inherent-types/private-in-public.stderr create mode 100644 tests/ui/associated-inherent-types/regionck-0.rs create mode 100644 tests/ui/associated-inherent-types/regionck-0.stderr create mode 100644 tests/ui/associated-inherent-types/regionck-1.rs create mode 100644 tests/ui/associated-inherent-types/regionck-1.stderr create mode 100644 tests/ui/associated-inherent-types/regionck-2.rs create mode 100644 tests/ui/associated-inherent-types/regionck-2.stderr create mode 100644 tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs create mode 100644 tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.rs create mode 100644 tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr create mode 100644 tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.rs create mode 100644 tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr diff --git a/compiler/rustc_hir_analysis/src/astconv/mod.rs b/compiler/rustc_hir_analysis/src/astconv/mod.rs index c199b9da6fee..e50e4800621f 100644 --- a/compiler/rustc_hir_analysis/src/astconv/mod.rs +++ b/compiler/rustc_hir_analysis/src/astconv/mod.rs @@ -2378,6 +2378,10 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { return Ok(None); } + // + // Select applicable inherent associated type candidates modulo regions. + // + // In contexts that have no inference context, just make a new one. // We do need a local variable to store it, though. let infcx_; @@ -2390,7 +2394,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { } }; - let param_env = tcx.param_env(block.owner.to_def_id()); + // FIXME(inherent_associated_types): Acquiring the ParamEnv this early leads to cycle errors + // when inside of an ADT (#108491) or where clause. + let param_env = tcx.param_env(block.owner); let cause = ObligationCause::misc(span, block.owner.def_id); let mut fulfillment_errors = Vec::new(); @@ -2398,6 +2404,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { let universe = infcx.create_next_universe(); // Regions are not considered during selection. + // FIXME(non_lifetime_binders): Here we are "truncating" or "flattening" the universes + // of type and const binders. Is that correct in the selection phase? See also #109505. let self_ty = tcx.replace_escaping_bound_vars_uncached( self_ty, FnMutDelegate { @@ -2413,41 +2421,40 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { candidates .iter() - .filter_map(|&(impl_, (assoc_item, def_scope))| { + .copied() + .filter(|&(impl_, _)| { infcx.probe(|_| { let ocx = ObligationCtxt::new_in_snapshot(&infcx); - let impl_ty = tcx.type_of(impl_); let impl_substs = infcx.fresh_item_substs(impl_); - let impl_ty = impl_ty.subst(tcx, impl_substs); + let impl_ty = tcx.type_of(impl_).subst(tcx, impl_substs); let impl_ty = ocx.normalize(&cause, param_env, impl_ty); - // Check that the Self-types can be related. - // FIXME(fmease): Should we use `eq` here? - ocx.sup(&ObligationCause::dummy(), param_env, impl_ty, self_ty).ok()?; + // Check that the self types can be related. + // FIXME(inherent_associated_types): Should we use `eq` here? Method probing uses + // `sup` for this situtation, too. What for? To constrain inference variables? + if ocx.sup(&ObligationCause::dummy(), param_env, impl_ty, self_ty).is_err() + { + return false; + } // Check whether the impl imposes obligations we have to worry about. - let impl_bounds = tcx.predicates_of(impl_); - let impl_bounds = impl_bounds.instantiate(tcx, impl_substs); - + let impl_bounds = tcx.predicates_of(impl_).instantiate(tcx, impl_substs); let impl_bounds = ocx.normalize(&cause, param_env, impl_bounds); - let impl_obligations = traits::predicates_for_generics( |_, _| cause.clone(), param_env, impl_bounds, ); - ocx.register_obligations(impl_obligations); let mut errors = ocx.select_where_possible(); if !errors.is_empty() { fulfillment_errors.append(&mut errors); - return None; + return false; } - // FIXME(fmease): Unsolved vars can escape this InferCtxt snapshot. - Some((assoc_item, def_scope, infcx.resolve_vars_if_possible(impl_substs))) + true }) }) .collect() @@ -2456,24 +2463,26 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o { if applicable_candidates.len() > 1 { return Err(self.complain_about_ambiguous_inherent_assoc_type( name, - applicable_candidates.into_iter().map(|(candidate, ..)| candidate).collect(), + applicable_candidates.into_iter().map(|(_, (candidate, _))| candidate).collect(), span, )); } - if let Some((assoc_item, def_scope, impl_substs)) = applicable_candidates.pop() { + if let Some((impl_, (assoc_item, def_scope))) = applicable_candidates.pop() { self.check_assoc_ty(assoc_item, name, def_scope, block, span); - // FIXME(inherent_associated_types): To fully *confirm* the *probed* candidate, we still - // need to relate the Self-type with fresh item substs & register region obligations for - // regionck to prove/disprove. + // FIXME(fmease): Currently creating throwaway `parent_substs` to please + // `create_substs_for_associated_item`. Modify the latter instead (or sth. similar) to + // not require the parent substs logic. + let parent_substs = InternalSubsts::identity_for_item(tcx, impl_); + let substs = + self.create_substs_for_associated_item(span, assoc_item, segment, parent_substs); + let substs = tcx.mk_substs_from_iter( + std::iter::once(ty::GenericArg::from(self_ty)) + .chain(substs.into_iter().skip(parent_substs.len())), + ); - let item_substs = - self.create_substs_for_associated_item(span, assoc_item, segment, impl_substs); - - // FIXME(fmease, #106722): Check if the bounds on the parameters of the - // associated type hold, if any. - let ty = tcx.type_of(assoc_item).subst(tcx, item_substs); + let ty = tcx.mk_alias(ty::Inherent, tcx.mk_alias_ty(assoc_item, substs)); return Ok(Some((ty, assoc_item))); } diff --git a/compiler/rustc_hir_analysis/src/coherence/orphan.rs b/compiler/rustc_hir_analysis/src/coherence/orphan.rs index 5ce8a83aad7f..272177dfbd0f 100644 --- a/compiler/rustc_hir_analysis/src/coherence/orphan.rs +++ b/compiler/rustc_hir_analysis/src/coherence/orphan.rs @@ -210,6 +210,19 @@ fn do_orphan_check_impl<'tcx>( NonlocalImpl::DisallowOther, ), + // ``` + // struct S(T); + // impl S { + // type This = T; + // } + // impl AutoTrait for S::This {} + // ``` + // FIXME(inherent_associated_types): The example code above currently leads to a cycle + ty::Alias(AliasKind::Inherent, _) => ( + LocalImpl::Disallow { problematic_kind: "associated type" }, + NonlocalImpl::DisallowOther, + ), + // type Opaque = impl Trait; // impl AutoTrait for Opaque {} ty::Alias(AliasKind::Opaque, _) => ( 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 2e5d058c6ed4..cb80e5b13508 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -1938,7 +1938,7 @@ fn is_late_bound_map( ty::Param(param_ty) => { self.arg_is_constrained[param_ty.index as usize] = true; } - ty::Alias(ty::Projection, _) => return ControlFlow::Continue(()), + ty::Alias(ty::Projection | ty::Inherent, _) => return ControlFlow::Continue(()), _ => (), } t.super_visit_with(self) diff --git a/compiler/rustc_hir_analysis/src/collect/type_of.rs b/compiler/rustc_hir_analysis/src/collect/type_of.rs index c20fbfd1e408..8df0166f76b4 100644 --- a/compiler/rustc_hir_analysis/src/collect/type_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/type_of.rs @@ -127,7 +127,7 @@ fn anon_const_type_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: LocalDefId) -> Ty<'tcx> { // the def_id that this query was called with. We filter to only type and const args here // as a precaution for if it's ever allowed to elide lifetimes in GAT's. It currently isn't // but it can't hurt to be safe ^^ - if let ty::Alias(ty::Projection, projection) = ty.kind() { + if let ty::Alias(ty::Projection | ty::Inherent, projection) = ty.kind() { let generics = tcx.generics_of(projection.def_id); let arg_index = segment diff --git a/compiler/rustc_hir_analysis/src/constrained_generic_params.rs b/compiler/rustc_hir_analysis/src/constrained_generic_params.rs index e18b0f082798..9200c2aecf55 100644 --- a/compiler/rustc_hir_analysis/src/constrained_generic_params.rs +++ b/compiler/rustc_hir_analysis/src/constrained_generic_params.rs @@ -59,7 +59,7 @@ struct ParameterCollector { impl<'tcx> TypeVisitor> for ParameterCollector { fn visit_ty(&mut self, t: Ty<'tcx>) -> ControlFlow { match *t.kind() { - ty::Alias(ty::Projection, ..) if !self.include_nonconstraining => { + ty::Alias(ty::Projection | ty::Inherent, ..) if !self.include_nonconstraining => { // projections are not injective return ControlFlow::Continue(()); } diff --git a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs index d53c429ca15c..0cd2fc1aa299 100644 --- a/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs +++ b/compiler/rustc_hir_analysis/src/outlives/implicit_infer.rs @@ -210,6 +210,9 @@ fn insert_required_predicates_to_be_wf<'tcx>( ); } + // FIXME(inherent_associated_types): Handle this case properly. + ty::Alias(ty::Inherent, _) => {} + _ => {} } } diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs index 70ce45e21ea5..05e5d850bf95 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/adjust_fulfillment_errors.rs @@ -843,7 +843,7 @@ fn find_param_in_ty<'tcx>( return true; } if let ty::GenericArgKind::Type(ty) = arg.unpack() - && let ty::Alias(ty::Projection, ..) = ty.kind() + && let ty::Alias(ty::Projection | ty::Inherent, ..) = ty.kind() { // This logic may seem a bit strange, but typically when // we have a projection type in a function signature, the diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs index 73a7bbebb658..67f45f9aa3f0 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/mod.rs @@ -300,7 +300,7 @@ impl<'a, 'tcx> AstConv<'tcx> for FnCtxt<'a, 'tcx> { match ty.kind() { ty::Adt(adt_def, _) => Some(*adt_def), // FIXME(#104767): Should we handle bound regions here? - ty::Alias(ty::Projection, _) if !ty.has_escaping_bound_vars() => { + ty::Alias(ty::Projection | ty::Inherent, _) if !ty.has_escaping_bound_vars() => { self.normalize(span, ty).ty_adt_def() } _ => None, diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 30f0978d190c..3741672e5683 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -2211,7 +2211,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { | ty::Float(_) | ty::Adt(_, _) | ty::Str - | ty::Alias(ty::Projection, _) + | ty::Alias(ty::Projection | ty::Inherent, _) | ty::Param(_) => format!("{deref_ty}"), // we need to test something like <&[_]>::len or <(&[u32])>::len // and Vec::function(); diff --git a/compiler/rustc_infer/src/infer/combine.rs b/compiler/rustc_infer/src/infer/combine.rs index c9e13be02ff9..44c8b08196e5 100644 --- a/compiler/rustc_infer/src/infer/combine.rs +++ b/compiler/rustc_infer/src/infer/combine.rs @@ -125,7 +125,8 @@ impl<'tcx> InferCtxt<'tcx> { bug!() } - (_, ty::Alias(AliasKind::Projection, _)) | (ty::Alias(AliasKind::Projection, _), _) + (_, ty::Alias(AliasKind::Projection | AliasKind::Inherent, _)) + | (ty::Alias(AliasKind::Projection | AliasKind::Inherent, _), _) if self.tcx.trait_solver_next() => { relation.register_type_relate_obligation(a, b); diff --git a/compiler/rustc_infer/src/infer/error_reporting/mod.rs b/compiler/rustc_infer/src/infer/error_reporting/mod.rs index 98da5ba65b7b..ce70f39cc401 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/mod.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/mod.rs @@ -2354,7 +2354,9 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { let labeled_user_string = match bound_kind { GenericKind::Param(ref p) => format!("the parameter type `{}`", p), GenericKind::Alias(ref p) => match p.kind(self.tcx) { - ty::AliasKind::Projection => format!("the associated type `{}`", p), + ty::AliasKind::Projection | ty::AliasKind::Inherent => { + format!("the associated type `{}`", p) + } ty::AliasKind::Opaque => format!("the opaque type `{}`", p), }, }; diff --git a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs index a31163519404..064811bd29d7 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/note_and_explain.rs @@ -71,9 +71,10 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> { #traits-as-parameters", ); } - (ty::Alias(ty::Projection, _), ty::Alias(ty::Projection, _)) => { + (ty::Alias(ty::Projection | ty::Inherent, _), ty::Alias(ty::Projection | ty::Inherent, _)) => { diag.note("an associated type was expected, but a different one was found"); } + // FIXME(inherent_associated_types): Extend this to support `ty::Inherent`, too. (ty::Param(p), ty::Alias(ty::Projection, proj)) | (ty::Alias(ty::Projection, proj), ty::Param(p)) if !tcx.is_impl_trait_in_trait(proj.def_id) => { @@ -222,7 +223,7 @@ impl Trait for X { diag.span_label(p_span, "this type parameter"); } } - (ty::Alias(ty::Projection, proj_ty), _) if !tcx.is_impl_trait_in_trait(proj_ty.def_id) => { + (ty::Alias(ty::Projection | ty::Inherent, proj_ty), _) if !tcx.is_impl_trait_in_trait(proj_ty.def_id) => { self.expected_projection( diag, proj_ty, @@ -231,7 +232,7 @@ impl Trait for X { cause.code(), ); } - (_, ty::Alias(ty::Projection, proj_ty)) if !tcx.is_impl_trait_in_trait(proj_ty.def_id) => { + (_, ty::Alias(ty::Projection | ty::Inherent, proj_ty)) if !tcx.is_impl_trait_in_trait(proj_ty.def_id) => { let msg = format!( "consider constraining the associated type `{}` to `{}`", values.found, values.expected, diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index 334395945ea9..362b22b23a8d 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -549,6 +549,7 @@ impl<'tcx> InferCtxt<'tcx> { // We can't normalize associated types from `rustc_infer`, // but we can eagerly register inference variables for them. // FIXME(RPITIT): Don't replace RPITITs with inference vars. + // FIXME(inherent_associated_types): Extend this to support `ty::Inherent`, too. ty::Alias(ty::Projection, projection_ty) if !projection_ty.has_escaping_bound_vars() && !tcx.is_impl_trait_in_trait(projection_ty.def_id) => @@ -569,6 +570,7 @@ impl<'tcx> InferCtxt<'tcx> { hidden_ty } // FIXME(RPITIT): This can go away when we move to associated types + // FIXME(inherent_associated_types): Extend this to support `ty::Inherent`, too. ty::Alias( ty::Projection, ty::AliasTy { def_id: def_id2, substs: substs2, .. }, diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index aeb791901bd2..08c02e1c253c 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -62,6 +62,7 @@ use rustc_middle::lint::in_external_macro; use rustc_middle::ty::layout::{LayoutError, LayoutOf}; use rustc_middle::ty::print::with_no_trimmed_paths; use rustc_middle::ty::subst::GenericArgKind; +use rustc_middle::ty::TypeVisitableExt; use rustc_middle::ty::{self, Instance, Ty, TyCtxt, VariantDef}; use rustc_session::lint::{BuiltinLintDiagnostics, FutureIncompatibilityReason}; use rustc_span::edition::Edition; @@ -1461,6 +1462,10 @@ impl<'tcx> LateLintPass<'tcx> for TypeAliasBounds { // Bounds are respected for `type X = impl Trait` return; } + if cx.tcx.type_of(item.owner_id).skip_binder().has_inherent_projections() { + // Bounds are respected for `type X = … Type::Inherent …` + return; + } // There must not be a where clause if type_alias_generics.predicates.is_empty() { return; @@ -1580,7 +1585,6 @@ declare_lint_pass!( impl<'tcx> LateLintPass<'tcx> for TrivialConstraints { fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) { - use rustc_middle::ty::visit::TypeVisitableExt; use rustc_middle::ty::Clause; use rustc_middle::ty::PredicateKind::*; @@ -2917,6 +2921,7 @@ impl ClashingExternDeclarations { | (Generator(..), Generator(..)) | (GeneratorWitness(..), GeneratorWitness(..)) | (Alias(ty::Projection, ..), Alias(ty::Projection, ..)) + | (Alias(ty::Inherent, ..), Alias(ty::Inherent, ..)) | (Alias(ty::Opaque, ..), Alias(ty::Opaque, ..)) => false, // These definitely should have been caught above. diff --git a/compiler/rustc_lint/src/types.rs b/compiler/rustc_lint/src/types.rs index a6ba742201a3..125b4dc55031 100644 --- a/compiler/rustc_lint/src/types.rs +++ b/compiler/rustc_lint/src/types.rs @@ -1119,14 +1119,14 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { // `extern "C" fn` functions can have type parameters, which may or may not be FFI-safe, // so they are currently ignored for the purposes of this lint. - ty::Param(..) | ty::Alias(ty::Projection, ..) + ty::Param(..) | ty::Alias(ty::Projection | ty::Inherent, ..) if matches!(self.mode, CItemKind::Definition) => { FfiSafe } ty::Param(..) - | ty::Alias(ty::Projection, ..) + | ty::Alias(ty::Projection | ty::Inherent, ..) | ty::Infer(..) | ty::Bound(..) | ty::Error(_) diff --git a/compiler/rustc_middle/src/query/mod.rs b/compiler/rustc_middle/src/query/mod.rs index be2657d25a69..ab73832ae68a 100644 --- a/compiler/rustc_middle/src/query/mod.rs +++ b/compiler/rustc_middle/src/query/mod.rs @@ -1821,6 +1821,16 @@ rustc_queries! { desc { "normalizing `{}`", goal.value.value } } + /// Do not call this query directly: invoke `normalize` instead. + query normalize_inherent_projection_ty( + goal: CanonicalProjectionGoal<'tcx> + ) -> Result< + &'tcx Canonical<'tcx, canonical::QueryResponse<'tcx, NormalizationResult<'tcx>>>, + NoSolution, + > { + desc { "normalizing `{}`", goal.value.value } + } + /// Do not call this query directly: invoke `try_normalize_erasing_regions` instead. query try_normalize_generic_arg_after_erasing_regions( goal: ParamEnvAnd<'tcx, GenericArg<'tcx>> diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs index c62254cd79cb..212720f3b694 100644 --- a/compiler/rustc_middle/src/ty/context.rs +++ b/compiler/rustc_middle/src/ty/context.rs @@ -1846,7 +1846,17 @@ impl<'tcx> TyCtxt<'tcx> { let substs = substs.into_iter().map(Into::into); #[cfg(debug_assertions)] { - let n = self.generics_of(_def_id).count(); + let generics = self.generics_of(_def_id); + + let n = if let DefKind::AssocTy = self.def_kind(_def_id) + && let DefKind::Impl { of_trait: false } = self.def_kind(self.parent(_def_id)) + { + // If this is an inherent projection. + + generics.params.len() + 1 + } else { + generics.count() + }; assert_eq!( (n, Some(n)), substs.size_hint(), @@ -2007,7 +2017,7 @@ impl<'tcx> TyCtxt<'tcx> { debug_assert_matches!( (kind, self.def_kind(alias_ty.def_id)), (ty::Opaque, DefKind::OpaqueTy) - | (ty::Projection, DefKind::AssocTy) + | (ty::Projection | ty::Inherent, DefKind::AssocTy) | (ty::Opaque | ty::Projection, DefKind::ImplTraitPlaceholder) ); self.mk_ty_from_kind(Alias(kind, alias_ty)) diff --git a/compiler/rustc_middle/src/ty/error.rs b/compiler/rustc_middle/src/ty/error.rs index 1be61e16dbed..49ab9b79e96f 100644 --- a/compiler/rustc_middle/src/ty/error.rs +++ b/compiler/rustc_middle/src/ty/error.rs @@ -265,7 +265,7 @@ impl<'tcx> Ty<'tcx> { ty::Infer(ty::FreshTy(_)) => "fresh type".into(), ty::Infer(ty::FreshIntTy(_)) => "fresh integral type".into(), ty::Infer(ty::FreshFloatTy(_)) => "fresh floating-point type".into(), - ty::Alias(ty::Projection, _) => "associated type".into(), + ty::Alias(ty::Projection | ty::Inherent, _) => "associated type".into(), ty::Param(p) => format!("type parameter `{p}`").into(), ty::Alias(ty::Opaque, ..) => if tcx.ty_is_opaque_future(self) { "future".into() } else { "opaque type".into() }, ty::Error(_) => "type error".into(), @@ -312,7 +312,7 @@ impl<'tcx> Ty<'tcx> { ty::Tuple(..) => "tuple".into(), ty::Placeholder(..) => "higher-ranked type".into(), ty::Bound(..) => "bound type variable".into(), - ty::Alias(ty::Projection, _) => "associated type".into(), + ty::Alias(ty::Projection | ty::Inherent, _) => "associated type".into(), ty::Param(_) => "type parameter".into(), ty::Alias(ty::Opaque, ..) => "opaque type".into(), } diff --git a/compiler/rustc_middle/src/ty/flags.rs b/compiler/rustc_middle/src/ty/flags.rs index 68002bfcfbd1..d64875a9f00e 100644 --- a/compiler/rustc_middle/src/ty/flags.rs +++ b/compiler/rustc_middle/src/ty/flags.rs @@ -176,14 +176,14 @@ impl FlagComputation { self.add_substs(substs); } - &ty::Alias(ty::Projection, data) => { - self.add_flags(TypeFlags::HAS_TY_PROJECTION); - self.add_alias_ty(data); - } + &ty::Alias(kind, data) => { + self.add_flags(match kind { + ty::Projection => TypeFlags::HAS_TY_PROJECTION, + ty::Inherent => TypeFlags::HAS_TY_INHERENT, + ty::Opaque => TypeFlags::HAS_TY_OPAQUE, + }); - &ty::Alias(ty::Opaque, ty::AliasTy { substs, .. }) => { - self.add_flags(TypeFlags::HAS_TY_OPAQUE); - self.add_substs(substs); + self.add_alias_ty(data); } &ty::Dynamic(obj, r, _) => { diff --git a/compiler/rustc_middle/src/ty/inhabitedness/mod.rs b/compiler/rustc_middle/src/ty/inhabitedness/mod.rs index 92a040068dd7..9e672004cf9c 100644 --- a/compiler/rustc_middle/src/ty/inhabitedness/mod.rs +++ b/compiler/rustc_middle/src/ty/inhabitedness/mod.rs @@ -113,6 +113,12 @@ impl<'tcx> Ty<'tcx> { } Never => InhabitedPredicate::False, Param(_) | Alias(ty::Projection, _) => InhabitedPredicate::GenericType(self), + // FIXME(inherent_associated_types): Most likely we can just map to `GenericType` like above. + // However it's unclear if the substs passed to `InhabitedPredicate::subst` are of the correct + // format, i.e. don't contain parent substs. If you hit this case, please verify this beforehand. + Alias(ty::Inherent, _) => { + bug!("unimplemented: inhabitedness checking for inherent projections") + } Tuple(tys) if tys.is_empty() => InhabitedPredicate::True, // use a query for more complex cases Adt(..) | Array(..) | Tuple(_) => tcx.inhabited_predicate_type(self), diff --git a/compiler/rustc_middle/src/ty/layout.rs b/compiler/rustc_middle/src/ty/layout.rs index f2a2e67cf82d..47cf48f46cf8 100644 --- a/compiler/rustc_middle/src/ty/layout.rs +++ b/compiler/rustc_middle/src/ty/layout.rs @@ -324,7 +324,7 @@ impl<'tcx> SizeSkeleton<'tcx> { let non_zero = !ty.is_unsafe_ptr(); let tail = tcx.struct_tail_erasing_lifetimes(pointee, param_env); match tail.kind() { - ty::Param(_) | ty::Alias(ty::Projection, _) => { + ty::Param(_) | ty::Alias(ty::Projection | ty::Inherent, _) => { debug_assert!(tail.has_non_region_param()); Ok(SizeSkeleton::Pointer { non_zero, tail: tcx.erase_regions(tail) }) } diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 23d6242899f2..9fc0110b354f 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1004,7 +1004,7 @@ impl<'tcx> Term<'tcx> { match self.unpack() { TermKind::Ty(ty) => match ty.kind() { ty::Alias(kind, alias_ty) => match kind { - AliasKind::Projection => Some(*alias_ty), + AliasKind::Projection | AliasKind::Inherent => Some(*alias_ty), AliasKind::Opaque => None, }, _ => None, diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index 6ac9f9504506..8a4d3820d7bc 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -729,7 +729,7 @@ pub trait PrettyPrinter<'tcx>: ty::Foreign(def_id) => { p!(print_def_path(def_id, &[])); } - ty::Alias(ty::Projection, ref data) => { + ty::Alias(ty::Projection | ty::Inherent, ref data) => { if !(self.should_print_verbose() || NO_QUERIES.with(|q| q.get())) && self.tcx().is_impl_trait_in_trait(data.def_id) { diff --git a/compiler/rustc_middle/src/ty/relate.rs b/compiler/rustc_middle/src/ty/relate.rs index 7f28ed6c2633..da43475941ee 100644 --- a/compiler/rustc_middle/src/ty/relate.rs +++ b/compiler/rustc_middle/src/ty/relate.rs @@ -550,6 +550,11 @@ pub fn super_relate_tys<'tcx, R: TypeRelation<'tcx>>( Ok(tcx.mk_projection(projection_ty.def_id, projection_ty.substs)) } + (&ty::Alias(ty::Inherent, a_data), &ty::Alias(ty::Inherent, b_data)) => { + let alias_ty = relation.relate(a_data, b_data)?; + Ok(tcx.mk_alias(ty::Inherent, tcx.mk_alias_ty(alias_ty.def_id, alias_ty.substs))) + } + ( &ty::Alias(ty::Opaque, ty::AliasTy { def_id: a_def_id, substs: a_substs, .. }), &ty::Alias(ty::Opaque, ty::AliasTy { def_id: b_def_id, substs: b_substs, .. }), diff --git a/compiler/rustc_middle/src/ty/sty.rs b/compiler/rustc_middle/src/ty/sty.rs index 646384eebc88..8d0737e1eeee 100644 --- a/compiler/rustc_middle/src/ty/sty.rs +++ b/compiler/rustc_middle/src/ty/sty.rs @@ -1190,9 +1190,9 @@ where /// Represents the projection of an associated type. /// -/// For a projection, this would be `>::N`. -/// -/// For an opaque type, there is no explicit syntax. +/// * For a projection, this would be `>::N<...>`. +/// * For an inherent projection, this would be `Ty::N<...>`. +/// * For an opaque type, there is no explicit syntax. #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, TyEncodable, TyDecodable)] #[derive(HashStable, TypeFoldable, TypeVisitable, Lift)] pub struct AliasTy<'tcx> { @@ -1201,12 +1201,16 @@ pub struct AliasTy<'tcx> { /// For a projection, these are the substitutions for the trait and the /// GAT substitutions, if there are any. /// + /// For an inherent projection, they consist of the self type and the GAT substitutions, + /// if there are any. + /// /// For RPIT the substitutions are for the generics of the function, /// while for TAIT it is used for the generic parameters of the alias. pub substs: SubstsRef<'tcx>, - /// The `DefId` of the `TraitItem` for the associated type `N` if this is a projection, - /// or the `OpaqueType` item if this is an opaque. + /// The `DefId` of the `TraitItem` or `ImplItem` for the associated type `N` depending on whether + /// this is a projection or an inherent projection or the `DefId` of the `OpaqueType` item if + /// this is an opaque. /// /// During codegen, `tcx.type_of(def_id)` can be used to get the type of the /// underlying type if the type is an opaque. @@ -1224,6 +1228,7 @@ pub struct AliasTy<'tcx> { impl<'tcx> AliasTy<'tcx> { pub fn kind(self, tcx: TyCtxt<'tcx>) -> ty::AliasKind { match tcx.def_kind(self.def_id) { + DefKind::AssocTy if let DefKind::Impl { of_trait: false } = tcx.def_kind(tcx.parent(self.def_id)) => ty::Inherent, DefKind::AssocTy | DefKind::ImplTraitPlaceholder => ty::Projection, DefKind::OpaqueTy => ty::Opaque, kind => bug!("unexpected DefKind in AliasTy: {kind:?}"), @@ -1236,6 +1241,17 @@ impl<'tcx> AliasTy<'tcx> { } /// The following methods work only with associated type projections. +impl<'tcx> AliasTy<'tcx> { + pub fn self_ty(self) -> Ty<'tcx> { + self.substs.type_at(0) + } + + pub fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self { + tcx.mk_alias_ty(self.def_id, [self_ty.into()].into_iter().chain(self.substs.iter().skip(1))) + } +} + +/// The following methods work only with trait associated type projections. impl<'tcx> AliasTy<'tcx> { pub fn trait_def_id(self, tcx: TyCtxt<'tcx>) -> DefId { match tcx.def_kind(self.def_id) { @@ -1274,13 +1290,28 @@ impl<'tcx> AliasTy<'tcx> { let def_id = self.trait_def_id(tcx); ty::TraitRef::new(tcx, def_id, self.substs.truncate_to(tcx, tcx.generics_of(def_id))) } +} - pub fn self_ty(self) -> Ty<'tcx> { - self.substs.type_at(0) - } +/// The following methods work only with inherent associated type projections. +impl<'tcx> AliasTy<'tcx> { + /// Transform the substitutions to have the given `impl` substs as the base and the GAT substs on top of that. + /// + /// Does the following transformation: + /// + /// ```text + /// [Self, P_0...P_m] -> [I_0...I_n, P_0...P_m] + /// + /// I_i impl subst + /// P_j GAT subst + /// ``` + pub fn rebase_substs_onto_impl( + self, + impl_substs: ty::SubstsRef<'tcx>, + tcx: TyCtxt<'tcx>, + ) -> ty::SubstsRef<'tcx> { + debug_assert_eq!(self.kind(tcx), ty::Inherent); - pub fn with_self_ty(self, tcx: TyCtxt<'tcx>, self_ty: Ty<'tcx>) -> Self { - tcx.mk_alias_ty(self.def_id, [self_ty.into()].into_iter().chain(self.substs.iter().skip(1))) + tcx.mk_substs_from_iter(impl_substs.into_iter().chain(self.substs.into_iter().skip(1))) } } diff --git a/compiler/rustc_middle/src/ty/visit.rs b/compiler/rustc_middle/src/ty/visit.rs index 5eaa58d69ed6..520bb55e031c 100644 --- a/compiler/rustc_middle/src/ty/visit.rs +++ b/compiler/rustc_middle/src/ty/visit.rs @@ -49,6 +49,9 @@ pub trait TypeVisitableExt<'tcx>: TypeVisitable> { fn has_projections(&self) -> bool { self.has_type_flags(TypeFlags::HAS_PROJECTION) } + fn has_inherent_projections(&self) -> bool { + self.has_type_flags(TypeFlags::HAS_TY_INHERENT) + } fn has_opaque_types(&self) -> bool { self.has_type_flags(TypeFlags::HAS_TY_OPAQUE) } diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index 04ac585076f9..d6eb5463870e 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -243,6 +243,39 @@ where // This will also visit substs if necessary, so we don't need to recurse. return self.visit_projection_ty(proj); } + ty::Alias(ty::Inherent, data) => { + if self.def_id_visitor.skip_assoc_tys() { + // Visitors searching for minimal visibility/reachability want to + // conservatively approximate associated types like `Type::Alias` + // as visible/reachable even if `Type` is private. + // Ideally, associated types should be substituted in the same way as + // free type aliases, but this isn't done yet. + return ControlFlow::Continue(()); + } + + self.def_id_visitor.visit_def_id( + data.def_id, + "associated type", + &LazyDefPathStr { def_id: data.def_id, tcx }, + )?; + + struct LazyDefPathStr<'tcx> { + def_id: DefId, + tcx: TyCtxt<'tcx>, + } + impl<'tcx> fmt::Display for LazyDefPathStr<'tcx> { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.tcx.def_path_str(self.def_id)) + } + } + + // This will also visit substs if necessary, so we don't need to recurse. + return if self.def_id_visitor.shallow() { + ControlFlow::Continue(()) + } else { + data.substs.iter().try_for_each(|subst| subst.visit_with(self)) + }; + } ty::Dynamic(predicates, ..) => { // All traits in the list are considered the "primary" part of the type // and are visited by shallow visitors. diff --git a/compiler/rustc_trait_selection/messages.ftl b/compiler/rustc_trait_selection/messages.ftl index 14eb4a5502d5..8fea3fc140d7 100644 --- a/compiler/rustc_trait_selection/messages.ftl +++ b/compiler/rustc_trait_selection/messages.ftl @@ -20,3 +20,5 @@ trait_selection_negative_positive_conflict = found both positive and negative im .negative_implementation_in_crate = negative implementation in crate `{$negative_impl_cname}` .positive_implementation_here = positive implementation here .positive_implementation_in_crate = positive implementation in crate `{$positive_impl_cname}` + +trait_selection_inherent_projection_normalization_overflow = overflow evaluating associated type `{$ty}` diff --git a/compiler/rustc_trait_selection/src/errors.rs b/compiler/rustc_trait_selection/src/errors.rs index df7c4df1868c..54e22cc3d7fe 100644 --- a/compiler/rustc_trait_selection/src/errors.rs +++ b/compiler/rustc_trait_selection/src/errors.rs @@ -89,3 +89,11 @@ impl IntoDiagnostic<'_> for NegativePositiveConflict<'_> { diag } } + +#[derive(Diagnostic)] +#[diag(trait_selection_inherent_projection_normalization_overflow)] +pub struct InherentProjectionNormalizationOverflow { + #[primary_span] + pub span: Span, + pub ty: String, +} diff --git a/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs b/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs index 996dc329dcb9..0ede32c753c6 100644 --- a/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs +++ b/compiler/rustc_trait_selection/src/solve/assembly/structural_traits.rs @@ -33,7 +33,7 @@ pub(in crate::solve) fn instantiate_constituent_tys_for_auto_trait<'tcx>( ty::Dynamic(..) | ty::Param(..) | ty::Foreign(..) - | ty::Alias(ty::Projection, ..) + | ty::Alias(ty::Projection | ty::Inherent, ..) | ty::Placeholder(..) | ty::Bound(..) | ty::Infer(_) => { diff --git a/compiler/rustc_trait_selection/src/solve/trait_goals.rs b/compiler/rustc_trait_selection/src/solve/trait_goals.rs index 6c98fadd1482..04b38edc1265 100644 --- a/compiler/rustc_trait_selection/src/solve/trait_goals.rs +++ b/compiler/rustc_trait_selection/src/solve/trait_goals.rs @@ -655,7 +655,7 @@ impl<'tcx> EvalCtxt<'_, 'tcx> { ty::Dynamic(..) | ty::Param(..) | ty::Foreign(..) - | ty::Alias(ty::Projection, ..) + | ty::Alias(ty::Projection | ty::Inherent, ..) | ty::Placeholder(..) => Some(Err(NoSolution)), ty::Infer(_) | ty::Bound(_, _) => bug!("unexpected type `{self_ty}`"), diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index b7690f79933d..402b09419c87 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -673,7 +673,7 @@ impl<'tcx> TypeVisitor> for OrphanChecker<'tcx> { | ty::RawPtr(..) | ty::Never | ty::Tuple(..) - | ty::Alias(ty::Projection, ..) => self.found_non_local_ty(ty), + | ty::Alias(ty::Projection | ty::Inherent, ..) => self.found_non_local_ty(ty), ty::Param(..) => self.found_param_ty(ty), diff --git a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs index 8f2a5d649f09..3884153202eb 100644 --- a/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs @@ -1686,13 +1686,14 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> { ty::Tuple(..) => Some(10), ty::Param(..) => Some(11), ty::Alias(ty::Projection, ..) => Some(12), - ty::Alias(ty::Opaque, ..) => Some(13), - ty::Never => Some(14), - ty::Adt(..) => Some(15), - ty::Generator(..) => Some(16), - ty::Foreign(..) => Some(17), - ty::GeneratorWitness(..) => Some(18), - ty::GeneratorWitnessMIR(..) => Some(19), + ty::Alias(ty::Inherent, ..) => Some(13), + ty::Alias(ty::Opaque, ..) => Some(14), + ty::Never => Some(15), + ty::Adt(..) => Some(16), + ty::Generator(..) => Some(17), + ty::Foreign(..) => Some(18), + ty::GeneratorWitness(..) => Some(19), + ty::GeneratorWitnessMIR(..) => Some(20), ty::Placeholder(..) | ty::Bound(..) | ty::Infer(..) | ty::Error(_) => None, } } diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 8b8c50f6b836..5878accd84aa 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -49,7 +49,8 @@ pub use self::object_safety::astconv_object_safety_violations; pub use self::object_safety::is_vtable_safe_method; pub use self::object_safety::MethodViolationCode; pub use self::object_safety::ObjectSafetyViolation; -pub use self::project::{normalize_projection_type, NormalizeExt}; +pub use self::project::NormalizeExt; +pub use self::project::{normalize_inherent_projection, normalize_projection_type}; pub use self::select::{EvaluationCache, SelectionCache, SelectionContext}; pub use self::select::{EvaluationResult, IntercrateAmbiguityCause, OverflowError}; pub use self::specialize::specialization_graph::FutureCompatOverlapError; diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 8c74860cdf34..852780fccace 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -16,6 +16,7 @@ use super::{ }; use super::{Normalized, NormalizedTy, ProjectionCacheEntry, ProjectionCacheKey}; +use crate::errors::InherentProjectionNormalizationOverflow; use crate::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind}; use crate::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime}; use crate::traits::error_reporting::TypeErrCtxtExt as _; @@ -370,10 +371,14 @@ pub(crate) fn needs_normalization<'tcx, T: TypeVisitable>>( reveal: Reveal, ) -> bool { match reveal { - Reveal::UserFacing => value - .has_type_flags(ty::TypeFlags::HAS_TY_PROJECTION | ty::TypeFlags::HAS_CT_PROJECTION), + Reveal::UserFacing => value.has_type_flags( + ty::TypeFlags::HAS_TY_PROJECTION + | ty::TypeFlags::HAS_TY_INHERENT + | ty::TypeFlags::HAS_CT_PROJECTION, + ), Reveal::All => value.has_type_flags( ty::TypeFlags::HAS_TY_PROJECTION + | ty::TypeFlags::HAS_TY_INHERENT | ty::TypeFlags::HAS_TY_OPAQUE | ty::TypeFlags::HAS_CT_PROJECTION, ), @@ -616,6 +621,51 @@ impl<'a, 'b, 'tcx> TypeFolder> for AssocTypeNormalizer<'a, 'b, 'tcx ); normalized_ty } + + ty::Inherent if !data.has_escaping_bound_vars() => { + // This branch is *mostly* just an optimization: when we don't + // have escaping bound vars, we don't need to replace them with + // placeholders (see branch below). *Also*, we know that we can + // register an obligation to *later* project, since we know + // there won't be bound vars there. + + let data = data.fold_with(self); + + // FIXME(inherent_associated_types): Do we need to honor `self.eager_inference_replacement` + // here like `ty::Projection`? + normalize_inherent_projection( + self.selcx, + self.param_env, + data, + self.cause.clone(), + self.depth, + &mut self.obligations, + ) + } + + ty::Inherent => { + let infcx = self.selcx.infcx; + let (data, mapped_regions, mapped_types, mapped_consts) = + BoundVarReplacer::replace_bound_vars(infcx, &mut self.universes, data); + let data = data.fold_with(self); + let ty = normalize_inherent_projection( + self.selcx, + self.param_env, + data, + self.cause.clone(), + self.depth, + &mut self.obligations, + ); + + PlaceholderReplacer::replace_placeholders( + infcx, + mapped_regions, + mapped_types, + mapped_consts, + &self.universes, + ty, + ) + } } } @@ -1204,6 +1254,95 @@ fn normalize_to_error<'a, 'tcx>( Normalized { value: new_value, obligations: vec![trait_obligation] } } +/// Confirm and normalize the given inherent projection. +#[instrument(level = "debug", skip(selcx, param_env, cause, obligations))] +pub fn normalize_inherent_projection<'a, 'b, 'tcx>( + selcx: &'a mut SelectionContext<'b, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + alias_ty: ty::AliasTy<'tcx>, + cause: ObligationCause<'tcx>, + depth: usize, + obligations: &mut Vec>, +) -> Ty<'tcx> { + let tcx = selcx.tcx(); + + if !tcx.recursion_limit().value_within_limit(depth) { + // Halt compilation because it is important that overflows never be masked. + tcx.sess.emit_fatal(InherentProjectionNormalizationOverflow { + span: cause.span, + ty: alias_ty.to_string(), + }); + } + + let impl_def_id = tcx.parent(alias_ty.def_id); + let impl_substs = selcx.infcx.fresh_substs_for_item(cause.span, impl_def_id); + + let impl_ty = tcx.type_of(impl_def_id).subst(tcx, impl_substs); + let impl_ty = + normalize_with_depth_to(selcx, param_env, cause.clone(), depth + 1, impl_ty, obligations); + + // Infer the generic parameters of the impl by unifying the + // impl type with the self type of the projection. + let self_ty = alias_ty.self_ty(); + match selcx.infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, impl_ty, self_ty) { + Ok(mut ok) => obligations.append(&mut ok.obligations), + Err(_) => { + tcx.sess.delay_span_bug( + cause.span, + format!( + "{self_ty:?} was a subtype of {impl_ty:?} during selection but now it is not" + ), + ); + } + } + + let substs = alias_ty.rebase_substs_onto_impl(impl_substs, tcx); + + // Register the obligations arising from the impl and from the associated type itself. + let predicates = tcx.predicates_of(alias_ty.def_id).instantiate(tcx, substs); + for (predicate, span) in predicates { + let predicate = normalize_with_depth_to( + selcx, + param_env, + cause.clone(), + depth + 1, + predicate, + obligations, + ); + + let nested_cause = ObligationCause::new( + cause.span, + cause.body_id, + // FIXME(inherent_associated_types): Since we can't pass along the self type to the + // cause code, inherent projections will be printed with identity substitutions in + // diagnostics which is not ideal. + // Consider creating separate cause codes for this specific situation. + if span.is_dummy() { + super::ItemObligation(alias_ty.def_id) + } else { + super::BindingObligation(alias_ty.def_id, span) + }, + ); + + obligations.push(Obligation::with_depth( + tcx, + nested_cause, + depth + 1, + param_env, + predicate, + )); + } + + let ty = tcx.type_of(alias_ty.def_id).subst(tcx, substs); + + let mut ty = selcx.infcx.resolve_vars_if_possible(ty); + if ty.has_projections() { + ty = normalize_with_depth_to(selcx, param_env, cause.clone(), depth + 1, ty, obligations); + } + + ty +} + enum Projected<'tcx> { Progress(Progress<'tcx>), NoProgress(ty::Term<'tcx>), diff --git a/compiler/rustc_trait_selection/src/traits/query/normalize.rs b/compiler/rustc_trait_selection/src/traits/query/normalize.rs index a986a9b6a71b..8bf934cb78ae 100644 --- a/compiler/rustc_trait_selection/src/traits/query/normalize.rs +++ b/compiler/rustc_trait_selection/src/traits/query/normalize.rs @@ -257,11 +257,11 @@ impl<'cx, 'tcx> FallibleTypeFolder> for QueryNormalizer<'cx, 'tcx> ty::Opaque => ty.try_super_fold_with(self)?, - ty::Projection => { + ty::Projection | ty::Inherent => { // See note in `rustc_trait_selection::traits::project` - let tcx = self.infcx.tcx; let infcx = self.infcx; + let tcx = infcx.tcx; // Just an optimization: When we don't have escaping bound vars, // we don't need to replace them with placeholders. let (data, maps) = if data.has_escaping_bound_vars() { @@ -276,12 +276,15 @@ impl<'cx, 'tcx> FallibleTypeFolder> for QueryNormalizer<'cx, 'tcx> let mut orig_values = OriginalQueryValues::default(); // HACK(matthewjasper) `'static` is special-cased in selection, // so we cannot canonicalize it. - let c_data = self - .infcx + let c_data = infcx .canonicalize_query_keep_static(self.param_env.and(data), &mut orig_values); debug!("QueryNormalizer: c_data = {:#?}", c_data); debug!("QueryNormalizer: orig_values = {:#?}", orig_values); - let result = tcx.normalize_projection_ty(c_data)?; + let result = match kind { + ty::Projection => tcx.normalize_projection_ty(c_data), + ty::Inherent => tcx.normalize_inherent_projection_ty(c_data), + _ => unreachable!(), + }?; // We don't expect ambiguity. if result.is_ambiguous() { // Rustdoc normalizes possibly not well-formed types, so only @@ -294,8 +297,8 @@ impl<'cx, 'tcx> FallibleTypeFolder> for QueryNormalizer<'cx, 'tcx> } return Err(NoSolution); } - let InferOk { value: result, obligations } = - self.infcx.instantiate_query_response_and_region_obligations( + let InferOk { value: result, obligations } = infcx + .instantiate_query_response_and_region_obligations( self.cause, self.param_env, &orig_values, diff --git a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs index 33f502f81828..a8fb55df2d30 100644 --- a/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs +++ b/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs @@ -498,7 +498,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // this trait and type. } ty::Param(..) - | ty::Alias(ty::Projection, ..) + | ty::Alias(ty::Projection | ty::Inherent, ..) | ty::Placeholder(..) | ty::Bound(..) => { // In these cases, we don't know what the actual diff --git a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs index 422285d94740..616187b69dde 100644 --- a/compiler/rustc_trait_selection/src/traits/select/confirmation.rs +++ b/compiler/rustc_trait_selection/src/traits/select/confirmation.rs @@ -1268,7 +1268,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> { // If we have a projection type, make sure to normalize it so we replace it // with a fresh infer variable - ty::Alias(ty::Projection, ..) => { + ty::Alias(ty::Projection | ty::Inherent, ..) => { let predicate = normalize_with_depth_to( self, obligation.param_env, diff --git a/compiler/rustc_trait_selection/src/traits/select/mod.rs b/compiler/rustc_trait_selection/src/traits/select/mod.rs index 246d3ea2ef29..e4f5a84f4244 100644 --- a/compiler/rustc_trait_selection/src/traits/select/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/select/mod.rs @@ -2315,7 +2315,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> { | ty::Dynamic(..) | ty::Param(..) | ty::Foreign(..) - | ty::Alias(ty::Projection, ..) + | ty::Alias(ty::Projection | ty::Inherent, ..) | ty::Bound(..) | ty::Infer(ty::TyVar(_) | ty::FreshTy(_) | ty::FreshIntTy(_) | ty::FreshFloatTy(_)) => { bug!("asked to assemble constituent types of unexpected type: {:?}", t); diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index 22710c7c059a..e5edceda9444 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -605,6 +605,9 @@ impl<'tcx> WfPredicates<'tcx> { walker.skip_current_subtree(); // Subtree handled by compute_projection. self.compute_projection(data); } + ty::Alias(ty::Inherent, _) => { + // WF if their substs are WF. + } ty::Adt(def, substs) => { // WfNominalType diff --git a/compiler/rustc_traits/src/chalk/lowering.rs b/compiler/rustc_traits/src/chalk/lowering.rs index 4d225e36b22c..2f9e480d8bd5 100644 --- a/compiler/rustc_traits/src/chalk/lowering.rs +++ b/compiler/rustc_traits/src/chalk/lowering.rs @@ -372,6 +372,7 @@ impl<'tcx> LowerInto<'tcx, chalk_ir::Ty>> for Ty<'tcx> { substitution: substs.lower_into(interner), })) } + ty::Alias(ty::Inherent, _) => unimplemented!(), ty::Alias(ty::Opaque, ty::AliasTy { def_id, substs, .. }) => { chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Opaque(chalk_ir::OpaqueTy { opaque_ty_id: chalk_ir::OpaqueTyId(def_id), diff --git a/compiler/rustc_traits/src/normalize_projection_ty.rs b/compiler/rustc_traits/src/normalize_projection_ty.rs index e805eb428211..36d80a06ee7e 100644 --- a/compiler/rustc_traits/src/normalize_projection_ty.rs +++ b/compiler/rustc_traits/src/normalize_projection_ty.rs @@ -10,7 +10,7 @@ use rustc_trait_selection::traits::{self, ObligationCause, SelectionContext}; use std::sync::atomic::Ordering; pub(crate) fn provide(p: &mut Providers) { - *p = Providers { normalize_projection_ty, ..*p }; + *p = Providers { normalize_projection_ty, normalize_inherent_projection_ty, ..*p }; } fn normalize_projection_ty<'tcx>( @@ -42,3 +42,30 @@ fn normalize_projection_ty<'tcx>( }, ) } + +fn normalize_inherent_projection_ty<'tcx>( + tcx: TyCtxt<'tcx>, + goal: CanonicalProjectionGoal<'tcx>, +) -> Result<&'tcx Canonical<'tcx, QueryResponse<'tcx, NormalizationResult<'tcx>>>, NoSolution> { + debug!("normalize_provider(goal={:#?})", goal); + + tcx.infer_ctxt().enter_canonical_trait_query( + &goal, + |ocx, ParamEnvAnd { param_env, value: goal }| { + let selcx = &mut SelectionContext::new(ocx.infcx); + let cause = ObligationCause::dummy(); + let mut obligations = vec![]; + let answer = traits::normalize_inherent_projection( + selcx, + param_env, + goal, + cause, + 0, + &mut obligations, + ); + ocx.register_obligations(obligations); + + Ok(NormalizationResult { normalized_ty: answer }) + }, + ) +} diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs index 1e91e26e2afe..7e5a4d1c7353 100644 --- a/compiler/rustc_type_ir/src/lib.rs +++ b/compiler/rustc_type_ir/src/lib.rs @@ -229,29 +229,32 @@ bitflags! { /// Does this have `Projection`? const HAS_TY_PROJECTION = 1 << 10; + /// Does this have `Inherent`? + const HAS_TY_INHERENT = 1 << 11; /// Does this have `Opaque`? - const HAS_TY_OPAQUE = 1 << 11; + const HAS_TY_OPAQUE = 1 << 12; /// Does this have `ConstKind::Unevaluated`? - const HAS_CT_PROJECTION = 1 << 12; + const HAS_CT_PROJECTION = 1 << 13; /// Could this type be normalized further? const HAS_PROJECTION = TypeFlags::HAS_TY_PROJECTION.bits | TypeFlags::HAS_TY_OPAQUE.bits + | TypeFlags::HAS_TY_INHERENT.bits | TypeFlags::HAS_CT_PROJECTION.bits; /// Is an error type/const reachable? - const HAS_ERROR = 1 << 13; + const HAS_ERROR = 1 << 14; /// Does this have any region that "appears free" in the type? /// Basically anything but `ReLateBound` and `ReErased`. - const HAS_FREE_REGIONS = 1 << 14; + const HAS_FREE_REGIONS = 1 << 15; /// Does this have any `ReLateBound` regions? - const HAS_RE_LATE_BOUND = 1 << 15; + const HAS_RE_LATE_BOUND = 1 << 16; /// Does this have any `Bound` types? - const HAS_TY_LATE_BOUND = 1 << 16; + const HAS_TY_LATE_BOUND = 1 << 17; /// Does this have any `ConstKind::Bound` consts? - const HAS_CT_LATE_BOUND = 1 << 17; + const HAS_CT_LATE_BOUND = 1 << 18; /// Does this have any bound variables? /// Used to check if a global bound is safe to evaluate. const HAS_LATE_BOUND = TypeFlags::HAS_RE_LATE_BOUND.bits @@ -259,20 +262,20 @@ bitflags! { | TypeFlags::HAS_CT_LATE_BOUND.bits; /// Does this have any `ReErased` regions? - const HAS_RE_ERASED = 1 << 18; + const HAS_RE_ERASED = 1 << 19; /// Does this value have parameters/placeholders/inference variables which could be /// replaced later, in a way that would change the results of `impl` specialization? - const STILL_FURTHER_SPECIALIZABLE = 1 << 19; + const STILL_FURTHER_SPECIALIZABLE = 1 << 20; /// Does this value have `InferTy::FreshTy/FreshIntTy/FreshFloatTy`? - const HAS_TY_FRESH = 1 << 20; + const HAS_TY_FRESH = 1 << 21; /// Does this value have `InferConst::Fresh`? - const HAS_CT_FRESH = 1 << 21; + const HAS_CT_FRESH = 1 << 22; /// Does this have `Generator` or `GeneratorWitness`? - const HAS_TY_GENERATOR = 1 << 22; + const HAS_TY_GENERATOR = 1 << 23; } } diff --git a/compiler/rustc_type_ir/src/sty.rs b/compiler/rustc_type_ir/src/sty.rs index 4c1f2dd0e533..f7344bacc028 100644 --- a/compiler/rustc_type_ir/src/sty.rs +++ b/compiler/rustc_type_ir/src/sty.rs @@ -37,6 +37,7 @@ pub enum DynKind { #[derive(Encodable, Decodable, HashStable_Generic)] pub enum AliasKind { Projection, + Inherent, Opaque, } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 23449a25c3a5..72b60d95b8c1 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1836,6 +1836,10 @@ pub(crate) fn clean_middle_ty<'tcx>( clean_projection(bound_ty.rebind(*data), cx, parent_def_id) } + // FIXME(fmease): Clean inherent projections properly. This requires making the trait ref in + // `QPathData` optional or alternatively adding a new `clean::Type` variant. + ty::Alias(ty::Inherent, _data) => Type::Infer, + ty::Param(ref p) => { if let Some(bounds) = cx.impl_trait_bounds.remove(&p.index.into()) { ImplTrait(bounds) diff --git a/src/tools/clippy/clippy_lints/src/dereference.rs b/src/tools/clippy/clippy_lints/src/dereference.rs index 7f3f26bed7c7..b27ffe73ffda 100644 --- a/src/tools/clippy/clippy_lints/src/dereference.rs +++ b/src/tools/clippy/clippy_lints/src/dereference.rs @@ -1424,6 +1424,7 @@ fn ty_auto_deref_stability<'tcx>( continue; }, ty::Param(_) => TyPosition::new_deref_stable_for_result(precedence, ty), + ty::Alias(ty::Inherent, _) => unreachable!("inherent projection should have been normalized away above"), ty::Alias(ty::Projection, _) if ty.has_non_region_param() => { TyPosition::new_deref_stable_for_result(precedence, ty) }, diff --git a/tests/rustdoc/inherent-projections.rs b/tests/rustdoc/inherent-projections.rs new file mode 100644 index 000000000000..bdd881ab456d --- /dev/null +++ b/tests/rustdoc/inherent-projections.rs @@ -0,0 +1,14 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// FIXME(fmease): Properly render inherent projections. + +// @has inherent_projections/fn.create.html +// @has - '//pre[@class="rust item-decl"]' "create() -> _" +pub fn create() -> Owner::Metadata {} + +pub struct Owner; + +impl Owner { + pub type Metadata = (); +} diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs new file mode 100644 index 000000000000..f41574403d88 --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs @@ -0,0 +1,10 @@ +// known-bug: #108491 + +// FIXME(inherent_associated_types): This should pass. + +struct Foo { + bar: Self::Bar, +} +impl Foo { + pub type Bar = usize; +} diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr new file mode 100644 index 000000000000..f313c4946714 --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr @@ -0,0 +1,49 @@ +error[E0601]: `main` function not found in crate `cycle_iat_inside_of_adt` + --> $DIR/cycle-iat-inside-of-adt.rs:10:2 + | +LL | } + | ^ consider adding a `main` function to `$DIR/cycle-iat-inside-of-adt.rs` + +error[E0391]: cycle detected when computing predicates of `Foo` + --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + | +LL | struct Foo { + | ^^^^^^^^^^ + | +note: ...which requires computing predicates of `Foo`... + --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + | +LL | struct Foo { + | ^^^^^^^^^^ +note: ...which requires computing inferred outlives predicates of `Foo`... + --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + | +LL | struct Foo { + | ^^^^^^^^^^ + = note: ...which requires computing the inferred outlives predicates for items in this crate... +note: ...which requires computing type of `Foo::bar`... + --> $DIR/cycle-iat-inside-of-adt.rs:6:5 + | +LL | bar: Self::Bar, + | ^^^^^^^^^^^^^^ +note: ...which requires computing normalized predicates of `Foo`... + --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + | +LL | struct Foo { + | ^^^^^^^^^^ + = note: ...which again requires computing predicates of `Foo`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/cycle-iat-inside-of-adt.rs:5:1 + | +LL | / struct Foo { +LL | | bar: Self::Bar, +LL | | } +LL | | impl Foo { +LL | | pub type Bar = usize; +LL | | } + | |_^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0391, E0601. +For more information about an error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs new file mode 100644 index 000000000000..0c2a38b1173d --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs @@ -0,0 +1,16 @@ +// known-bug: unknown + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// FIXME(inherent_associated_types): This shouldn't lead to a cycle error. + +fn user() where S::P: std::fmt::Debug {} + +struct S; + +impl S { + type P = (); +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr new file mode 100644 index 000000000000..aaa9a39ea0f4 --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr @@ -0,0 +1,37 @@ +error[E0391]: cycle detected when computing predicates of `user` + --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1 + | +LL | fn user() where S::P: std::fmt::Debug {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: ...which requires computing predicates of `user`... + --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1 + | +LL | fn user() where S::P: std::fmt::Debug {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires computing explicit predicates of `user`... + --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1 + | +LL | fn user() where S::P: std::fmt::Debug {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +note: ...which requires computing normalized predicates of `user`... + --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1 + | +LL | fn user() where S::P: std::fmt::Debug {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: ...which again requires computing predicates of `user`, completing the cycle +note: cycle used when collecting item types in top-level module + --> $DIR/cycle-iat-inside-of-where-predicate.rs:3:1 + | +LL | / #![feature(inherent_associated_types)] +LL | | #![allow(incomplete_features)] +LL | | +LL | | // FIXME(inherent_associated_types): This shouldn't lead to a cycle error. +... | +LL | | +LL | | fn main() {} + | |____________^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0391`. diff --git a/tests/ui/associated-inherent-types/bugs/ice-substitution.rs b/tests/ui/associated-inherent-types/bugs/ice-substitution.rs deleted file mode 100644 index 53ac79e0561b..000000000000 --- a/tests/ui/associated-inherent-types/bugs/ice-substitution.rs +++ /dev/null @@ -1,23 +0,0 @@ -// known-bug: unknown -// failure-status: 101 -// normalize-stderr-test "note: .*\n\n" -> "" -// normalize-stderr-test "thread 'rustc' panicked.*\n" -> "" -// rustc-env:RUST_BACKTRACE=0 - -// FIXME: I presume a type variable that couldn't be solved by `resolve_vars_if_possible` -// escapes the InferCtxt snapshot. - -#![feature(inherent_associated_types)] -#![allow(incomplete_features)] - -struct Cont(T); - -impl Cont { - type Out = Vec; -} - -pub fn weird(x: T) { - let _: Cont<_>::Out = vec![true]; -} - -fn main() {} diff --git a/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr b/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr deleted file mode 100644 index 1648cfb266b5..000000000000 --- a/tests/ui/associated-inherent-types/bugs/ice-substitution.stderr +++ /dev/null @@ -1,6 +0,0 @@ -error: the compiler unexpectedly panicked. this is a bug. - -query stack during panic: -#0 [typeck] type-checking `weird` -#1 [used_trait_imports] finding used_trait_imports `weird` -end of query stack diff --git a/tests/ui/associated-inherent-types/bugs/inference-fail.rs b/tests/ui/associated-inherent-types/bugs/inference-fail.rs deleted file mode 100644 index a920b412b1a4..000000000000 --- a/tests/ui/associated-inherent-types/bugs/inference-fail.rs +++ /dev/null @@ -1,15 +0,0 @@ -// known-bug: unknown - -#![feature(inherent_associated_types)] -#![allow(incomplete_features)] - -struct S(T); - -impl S<()> { - type P = i128; -} - -fn main() { - // We fail to infer `_ == ()` here. - let _: S<_>::P; -} diff --git a/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs b/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs deleted file mode 100644 index 632dbf3854b2..000000000000 --- a/tests/ui/associated-inherent-types/bugs/lack-of-regionck.rs +++ /dev/null @@ -1,19 +0,0 @@ -// known-bug: unknown -// check-pass - -// We currently don't region-check inherent associated type projections at all. - -#![feature(inherent_associated_types)] -#![allow(incomplete_features, dead_code)] - -struct S(T); - -impl S<&'static ()> { - type T = (); -} - -fn usr<'a>() { - let _: S::<&'a ()>::T; // this should *fail* but it doesn't! -} - -fn main() {} diff --git a/tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs b/tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs new file mode 100644 index 000000000000..c7f66e645bb5 --- /dev/null +++ b/tests/ui/associated-inherent-types/bugs/wf-check-skipped.rs @@ -0,0 +1,15 @@ +// known-bug: #100041 +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// FIXME(inherent_associated_types): This should fail. + +struct Foo; + +impl Foo { + type Bar = (); +} + +fn main() -> Foo::Bar::> {} diff --git a/tests/ui/associated-inherent-types/dispatch-on-self-type-0.rs b/tests/ui/associated-inherent-types/dispatch-on-self-type-0.rs index f846bfa4168a..83be4f43b5e9 100644 --- a/tests/ui/associated-inherent-types/dispatch-on-self-type-0.rs +++ b/tests/ui/associated-inherent-types/dispatch-on-self-type-0.rs @@ -31,7 +31,7 @@ fn main() { let _: Select::Projection = (); let _: Choose::Result = (); - let _: Choose::Result = vec![true]; + let _: Choose<&str>::Result = vec!["…"]; // regression test for issue #108957 } // Test if we use the correct `ParamEnv` when proving obligations. diff --git a/tests/ui/associated-inherent-types/former-subst-ice.rs b/tests/ui/associated-inherent-types/former-subst-ice.rs new file mode 100644 index 000000000000..48390b9430b6 --- /dev/null +++ b/tests/ui/associated-inherent-types/former-subst-ice.rs @@ -0,0 +1,16 @@ +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Cont(T); + +impl Cont { + type Out = Vec; +} + +pub fn weird(x: T) { + let _: Cont<_>::Out = vec![true]; +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr new file mode 100644 index 000000000000..464b59c249fe --- /dev/null +++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.item.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/generic-associated-types-bad.rs:16:10 + | +LL | const _: Ty::Pr = String::new(); + | ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound in `Ty::Pr` + --> $DIR/generic-associated-types-bad.rs:10:16 + | +LL | type Pr = T; + | ^^^^ required by this bound in `Ty::Pr` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr new file mode 100644 index 000000000000..4f371b24e803 --- /dev/null +++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.local.stderr @@ -0,0 +1,15 @@ +error[E0277]: the trait bound `Vec<()>: Copy` is not satisfied + --> $DIR/generic-associated-types-bad.rs:20:12 + | +LL | let _: Ty::Pr>; + | ^^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `Vec<()>` + | +note: required by a bound in `Ty::Pr` + --> $DIR/generic-associated-types-bad.rs:10:16 + | +LL | type Pr = T; + | ^^^^ required by this bound in `Ty::Pr` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr b/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr new file mode 100644 index 000000000000..74ec39424edc --- /dev/null +++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.region.stderr @@ -0,0 +1,11 @@ +error: lifetime may not live long enough + --> $DIR/generic-associated-types-bad.rs:25:12 + | +LL | fn user<'a>() { + | -- lifetime `'a` defined here +LL | #[cfg(region)] +LL | let _: Ty::Static<&'a str> = ""; + | ^^^^^^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/tests/ui/associated-inherent-types/generic-associated-types-bad.rs b/tests/ui/associated-inherent-types/generic-associated-types-bad.rs new file mode 100644 index 000000000000..e66392a0a941 --- /dev/null +++ b/tests/ui/associated-inherent-types/generic-associated-types-bad.rs @@ -0,0 +1,26 @@ +// revisions: item local region + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +#[derive(Clone, Copy)] +pub enum Ty {} + +impl Ty { + type Pr = T; + + type Static = Q; +} + +#[cfg(item)] +const _: Ty::Pr = String::new(); //[item]~ the trait bound `String: Copy` is not satisfied + +fn main() { + #[cfg(local)] + let _: Ty::Pr>; //[local]~ ERROR the trait bound `Vec<()>: Copy` is not satisfied +} + +fn user<'a>() { + #[cfg(region)] + let _: Ty::Static<&'a str> = ""; //[region]~ ERROR lifetime may not live long enough +} diff --git a/tests/ui/associated-inherent-types/inference-fail.rs b/tests/ui/associated-inherent-types/inference-fail.rs new file mode 100644 index 000000000000..939a4ff60f2b --- /dev/null +++ b/tests/ui/associated-inherent-types/inference-fail.rs @@ -0,0 +1,11 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S(T); + +impl S { type P = (); } + +fn main() { + // There is no way to infer this type. + let _: S<_>::P = (); //~ ERROR type annotations needed +} diff --git a/tests/ui/associated-inherent-types/bugs/inference-fail.stderr b/tests/ui/associated-inherent-types/inference-fail.stderr similarity index 53% rename from tests/ui/associated-inherent-types/bugs/inference-fail.stderr rename to tests/ui/associated-inherent-types/inference-fail.stderr index 425691bd6c4f..f29144e4aa75 100644 --- a/tests/ui/associated-inherent-types/bugs/inference-fail.stderr +++ b/tests/ui/associated-inherent-types/inference-fail.stderr @@ -1,8 +1,8 @@ error[E0282]: type annotations needed - --> $DIR/inference-fail.rs:14:14 + --> $DIR/inference-fail.rs:10:12 | -LL | let _: S<_>::P; - | ^ cannot infer type +LL | let _: S<_>::P = (); + | ^^^^^^^ cannot infer type for type parameter `T` error: aborting due to previous error diff --git a/tests/ui/associated-inherent-types/inference.rs b/tests/ui/associated-inherent-types/inference.rs new file mode 100644 index 000000000000..38179214fa12 --- /dev/null +++ b/tests/ui/associated-inherent-types/inference.rs @@ -0,0 +1,39 @@ +// Testing inference capabilities. +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +use std::convert::identity; + +struct Container(T); + +impl Container { + type Sink = (); +} + +impl Container { + type Thing = Any; +} + +impl Container<(T, ())> { + type Output = ((), Wrapped); +} + +fn main() { + // Inferred via the Self type of the impl. + let _: Container<_>::Sink; + + // Inferred via the RHS: + + let _: Container<_>::Thing = 0; + + let _: Container>::Thing = Wrapped(false); + + let _: Container<_>::Output = (drop(1), Wrapped("...")); + + let binding: Container<_>::Thing = Default::default(); // unsolved at this point + identity::(binding); // constrained and solved here +} + +struct Wrapped(T); diff --git a/tests/ui/associated-inherent-types/late-bound-regions.rs b/tests/ui/associated-inherent-types/late-bound-regions.rs new file mode 100644 index 000000000000..488a2cda649c --- /dev/null +++ b/tests/ui/associated-inherent-types/late-bound-regions.rs @@ -0,0 +1,25 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// Test if we correctly normalize `S<'a>::P` with respect to late-bound regions. + +type Function = for<'a> fn(&'a i32) -> S<'a>::P; + +struct S<'a>(&'a ()); + +trait Inter { + type P; +} + +impl<'a> S<'a> { + type P = &'a i32; +} + +fn ret_ref_local<'e>() -> &'e i32 { + let f: Function = |x| x; + + let local = 0; + f(&local) //~ ERROR cannot return value referencing local variable `local` +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/late-bound-regions.stderr b/tests/ui/associated-inherent-types/late-bound-regions.stderr new file mode 100644 index 000000000000..4706fcca91d0 --- /dev/null +++ b/tests/ui/associated-inherent-types/late-bound-regions.stderr @@ -0,0 +1,12 @@ +error[E0515]: cannot return value referencing local variable `local` + --> $DIR/late-bound-regions.rs:22:5 + | +LL | f(&local) + | ^^------^ + | | | + | | `local` is borrowed here + | returns a value referencing data owned by the current function + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0515`. diff --git a/tests/ui/associated-inherent-types/normalization-overflow.rs b/tests/ui/associated-inherent-types/normalization-overflow.rs new file mode 100644 index 000000000000..4228238aa7b7 --- /dev/null +++ b/tests/ui/associated-inherent-types/normalization-overflow.rs @@ -0,0 +1,12 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// FIXME(fmease): I'd prefer to report a cycle error here instead of an overflow one. + +struct T; + +impl T { + type This = Self::This; //~ ERROR overflow evaluating associated type `T::This` +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/normalization-overflow.stderr b/tests/ui/associated-inherent-types/normalization-overflow.stderr new file mode 100644 index 000000000000..16bb64281e3a --- /dev/null +++ b/tests/ui/associated-inherent-types/normalization-overflow.stderr @@ -0,0 +1,8 @@ +error: overflow evaluating associated type `T::This` + --> $DIR/normalization-overflow.rs:9:17 + | +LL | type This = Self::This; + | ^^^^^^^^^^ + +error: aborting due to previous error + diff --git a/tests/ui/associated-inherent-types/private-in-public.rs b/tests/ui/associated-inherent-types/private-in-public.rs new file mode 100644 index 000000000000..a4b372537c78 --- /dev/null +++ b/tests/ui/associated-inherent-types/private-in-public.rs @@ -0,0 +1,26 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] +#![crate_type = "lib"] + +#![deny(private_in_public)] + +pub type PubAlias0 = PubTy::PrivAssocTy; +//~^ ERROR private associated type `PubTy::PrivAssocTy` in public interface (error E0446) +//~| WARNING this was previously accepted +pub type PubAlias1 = PrivTy::PubAssocTy; +//~^ ERROR private type `PrivTy` in public interface (error E0446) +//~| WARNING this was previously accepted +pub type PubAlias2 = PubTy::PubAssocTy; +//~^ ERROR private type `PrivTy` in public interface (error E0446) +//~| WARNING this was previously accepted + +pub struct PubTy; +impl PubTy { + type PrivAssocTy = (); + pub type PubAssocTy = T; +} + +struct PrivTy; +impl PrivTy { + pub type PubAssocTy = (); +} diff --git a/tests/ui/associated-inherent-types/private-in-public.stderr b/tests/ui/associated-inherent-types/private-in-public.stderr new file mode 100644 index 000000000000..f0a64e96179a --- /dev/null +++ b/tests/ui/associated-inherent-types/private-in-public.stderr @@ -0,0 +1,34 @@ +error: private associated type `PubTy::PrivAssocTy` in public interface (error E0446) + --> $DIR/private-in-public.rs:7:1 + | +LL | pub type PubAlias0 = PubTy::PrivAssocTy; + | ^^^^^^^^^^^^^^^^^^ + | + = warning: 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 #34537 +note: the lint level is defined here + --> $DIR/private-in-public.rs:5:9 + | +LL | #![deny(private_in_public)] + | ^^^^^^^^^^^^^^^^^ + +error: private type `PrivTy` in public interface (error E0446) + --> $DIR/private-in-public.rs:10:1 + | +LL | pub type PubAlias1 = PrivTy::PubAssocTy; + | ^^^^^^^^^^^^^^^^^^ + | + = warning: 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 #34537 + +error: private type `PrivTy` in public interface (error E0446) + --> $DIR/private-in-public.rs:13:1 + | +LL | pub type PubAlias2 = PubTy::PubAssocTy; + | ^^^^^^^^^^^^^^^^^^ + | + = warning: 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 #34537 + +error: aborting due to 3 previous errors + diff --git a/tests/ui/associated-inherent-types/regionck-0.rs b/tests/ui/associated-inherent-types/regionck-0.rs new file mode 100644 index 000000000000..7c94539ace1f --- /dev/null +++ b/tests/ui/associated-inherent-types/regionck-0.rs @@ -0,0 +1,14 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S(T); + +impl S<&'static ()> { + type T = (); +} + +fn user<'a>() { + let _: S::<&'a ()>::T; //~ ERROR lifetime may not live long enough +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/regionck-0.stderr b/tests/ui/associated-inherent-types/regionck-0.stderr new file mode 100644 index 000000000000..3a438ee630e1 --- /dev/null +++ b/tests/ui/associated-inherent-types/regionck-0.stderr @@ -0,0 +1,10 @@ +error: lifetime may not live long enough + --> $DIR/regionck-0.rs:11:12 + | +LL | fn user<'a>() { + | -- lifetime `'a` defined here +LL | let _: S::<&'a ()>::T; + | ^^^^^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to previous error + diff --git a/tests/ui/associated-inherent-types/regionck-1.rs b/tests/ui/associated-inherent-types/regionck-1.rs new file mode 100644 index 000000000000..ec663cd0f77f --- /dev/null +++ b/tests/ui/associated-inherent-types/regionck-1.rs @@ -0,0 +1,13 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct U; + +impl U { + // Don't imply any bounds here. + + type NoTyOutliv<'a, T> = &'a T; //~ ERROR the parameter type `T` may not live long enough + type NoReOutliv<'a, 'b> = &'a &'b (); //~ ERROR reference has a longer lifetime than the data it references +} + +fn main() {} diff --git a/tests/ui/associated-inherent-types/regionck-1.stderr b/tests/ui/associated-inherent-types/regionck-1.stderr new file mode 100644 index 000000000000..b17d89ca306f --- /dev/null +++ b/tests/ui/associated-inherent-types/regionck-1.stderr @@ -0,0 +1,29 @@ +error[E0309]: the parameter type `T` may not live long enough + --> $DIR/regionck-1.rs:9:30 + | +LL | type NoTyOutliv<'a, T> = &'a T; + | ^^^^^- help: consider adding a where clause: `where T: 'a` + | | + | ...so that the reference type `&'a T` does not outlive the data it points at + +error[E0491]: in type `&'a &'b ()`, reference has a longer lifetime than the data it references + --> $DIR/regionck-1.rs:10:31 + | +LL | type NoReOutliv<'a, 'b> = &'a &'b (); + | ^^^^^^^^^^ + | +note: the pointer is valid for the lifetime `'a` as defined here + --> $DIR/regionck-1.rs:10:21 + | +LL | type NoReOutliv<'a, 'b> = &'a &'b (); + | ^^ +note: but the referenced data is only valid for the lifetime `'b` as defined here + --> $DIR/regionck-1.rs:10:25 + | +LL | type NoReOutliv<'a, 'b> = &'a &'b (); + | ^^ + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0309, E0491. +For more information about an error, try `rustc --explain E0309`. diff --git a/tests/ui/associated-inherent-types/regionck-2.rs b/tests/ui/associated-inherent-types/regionck-2.rs new file mode 100644 index 000000000000..7a0b8b083001 --- /dev/null +++ b/tests/ui/associated-inherent-types/regionck-2.rs @@ -0,0 +1,14 @@ +// Regression test for issue #109299. + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Lexer<'d>(&'d ()); + +impl Lexer<'static> { + type Cursor = (); +} + +fn test(_: Lexer::Cursor) {} //~ ERROR mismatched types + +fn main() {} diff --git a/tests/ui/associated-inherent-types/regionck-2.stderr b/tests/ui/associated-inherent-types/regionck-2.stderr new file mode 100644 index 000000000000..b0a4ed35d560 --- /dev/null +++ b/tests/ui/associated-inherent-types/regionck-2.stderr @@ -0,0 +1,18 @@ +error[E0308]: mismatched types + --> $DIR/regionck-2.rs:12:12 + | +LL | fn test(_: Lexer::Cursor) {} + | ^^^^^^^^^^^^^ lifetime mismatch + | + = note: expected struct `Lexer<'static>` + found struct `Lexer<'_>` +note: the anonymous lifetime defined here... + --> $DIR/regionck-2.rs:12:12 + | +LL | fn test(_: Lexer::Cursor) {} + | ^^^^^ + = note: ...does not necessarily outlive the static lifetime + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs new file mode 100644 index 000000000000..b32b4288ac9f --- /dev/null +++ b/tests/ui/associated-inherent-types/type-alias-bounds-are-enforced.rs @@ -0,0 +1,26 @@ +// check-pass +// compile-flags: --crate-type=lib + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +// Bounds on the self type play a major role in the resolution of inherent associated types (*). +// As a result of that, if a type alias contains any then its bounds have to be respected and the +// lint `type_alias_bounds` should not fire. +// +// FIXME(inherent_associated_types): In the current implementation that is. We might move the +// selection phase of IATs from hir_typeck to trait_selection resulting in us not requiring the +// ParamEnv that early allowing us to ignore bounds on type aliases again. +// Triage this before stabilization. + +#![deny(type_alias_bounds)] + +pub type Alias = (Source::Assoc,); + + +pub struct Source(T); +pub trait Bound {} + +impl Source { + pub type Assoc = (); +} diff --git a/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.rs b/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.rs new file mode 100644 index 000000000000..d081c4d5b78e --- /dev/null +++ b/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.rs @@ -0,0 +1,12 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S(T); + +impl S { + type T = T; +} + +fn main() { + let _: S<_>::T = String::new(); //~ ERROR the trait bound `String: Copy` is not satisfied +} diff --git a/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr b/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr new file mode 100644 index 000000000000..ecf30f4cdec5 --- /dev/null +++ b/tests/ui/associated-inherent-types/unsatisfied-bounds-inferred-type.stderr @@ -0,0 +1,17 @@ +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/unsatisfied-bounds-inferred-type.rs:11:12 + | +LL | let _: S<_>::T = String::new(); + | ^^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound in `S::T` + --> $DIR/unsatisfied-bounds-inferred-type.rs:6:9 + | +LL | impl S { + | ^^^^ required by this bound in `S::T` +LL | type T = T; + | - required by a bound in this associated type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. diff --git a/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.rs b/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.rs new file mode 100644 index 000000000000..97bd2c421604 --- /dev/null +++ b/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.rs @@ -0,0 +1,14 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct S(T); + +impl S { + type X = () + where + T: Copy; +} + +fn main() { + let _: S::::X; //~ ERROR the trait bound `String: Copy` is not satisfied +} diff --git a/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr b/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr new file mode 100644 index 000000000000..d4968cd05dce --- /dev/null +++ b/tests/ui/associated-inherent-types/unsatisfied-bounds-where-clause-on-assoc-ty.stderr @@ -0,0 +1,18 @@ +error[E0277]: the trait bound `String: Copy` is not satisfied + --> $DIR/unsatisfied-bounds-where-clause-on-assoc-ty.rs:13:12 + | +LL | let _: S::::X; + | ^^^^^^^^^^^^^^ the trait `Copy` is not implemented for `String` + | +note: required by a bound in `S::X` + --> $DIR/unsatisfied-bounds-where-clause-on-assoc-ty.rs:9:12 + | +LL | type X = () + | - required by a bound in this associated type +LL | where +LL | T: Copy; + | ^^^^ required by this bound in `S::X` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. From 46ec3486116dacbd4fcfa1d92943de7fcc17921a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Fri, 31 Mar 2023 02:02:46 +0200 Subject: [PATCH 10/97] IAT: Add a few regression tests --- .../associated-inherent-types/issue-109768.rs | 12 +++++++ .../issue-109768.stderr | 35 +++++++++++++++++++ .../associated-inherent-types/issue-109789.rs | 22 ++++++++++++ .../issue-109789.stderr | 21 +++++++++++ .../associated-inherent-types/issue-109790.rs | 17 +++++++++ 5 files changed, 107 insertions(+) create mode 100644 tests/ui/associated-inherent-types/issue-109768.rs create mode 100644 tests/ui/associated-inherent-types/issue-109768.stderr create mode 100644 tests/ui/associated-inherent-types/issue-109789.rs create mode 100644 tests/ui/associated-inherent-types/issue-109789.stderr create mode 100644 tests/ui/associated-inherent-types/issue-109790.rs diff --git a/tests/ui/associated-inherent-types/issue-109768.rs b/tests/ui/associated-inherent-types/issue-109768.rs new file mode 100644 index 000000000000..a3ae2e2ab447 --- /dev/null +++ b/tests/ui/associated-inherent-types/issue-109768.rs @@ -0,0 +1,12 @@ +// incremental + +struct Wrapper(T); + +struct Local(T, U); + +impl Local { //~ ERROR missing generics for struct `Local` + type AssocType3 = T; //~ ERROR inherent associated types are unstable + + const WRAPPED_ASSOC_3: Wrapper = Wrapper(); +} +//~^ ERROR `main` function not found diff --git a/tests/ui/associated-inherent-types/issue-109768.stderr b/tests/ui/associated-inherent-types/issue-109768.stderr new file mode 100644 index 000000000000..97706d4062a9 --- /dev/null +++ b/tests/ui/associated-inherent-types/issue-109768.stderr @@ -0,0 +1,35 @@ +error[E0601]: `main` function not found in crate `issue_109768` + --> $DIR/issue-109768.rs:11:2 + | +LL | } + | ^ consider adding a `main` function to `$DIR/issue-109768.rs` + +error[E0107]: missing generics for struct `Local` + --> $DIR/issue-109768.rs:7:9 + | +LL | impl Local { + | ^^^^^ expected 2 generic arguments + | +note: struct defined here, with 2 generic parameters: `T`, `U` + --> $DIR/issue-109768.rs:5:8 + | +LL | struct Local(T, U); + | ^^^^^ - - +help: add missing generic arguments + | +LL | impl Local { + | ++++++ + +error[E0658]: inherent associated types are unstable + --> $DIR/issue-109768.rs:8:5 + | +LL | type AssocType3 = T; + | ^^^^^^^^^^^^^^^^^^^^ + | + = note: see issue #8995 for more information + = help: add `#![feature(inherent_associated_types)]` to the crate attributes to enable + +error: aborting due to 3 previous errors + +Some errors have detailed explanations: E0107, E0601, E0658. +For more information about an error, try `rustc --explain E0107`. diff --git a/tests/ui/associated-inherent-types/issue-109789.rs b/tests/ui/associated-inherent-types/issue-109789.rs new file mode 100644 index 000000000000..0b5ba7d1fb55 --- /dev/null +++ b/tests/ui/associated-inherent-types/issue-109789.rs @@ -0,0 +1,22 @@ +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Foo(T); + +impl Foo { + type Assoc = u32; +} + +trait Other {} +impl Other for u32 {} + +// FIXME(inherent_associated_types): Avoid emitting two diagnostics (they only differ in span). +// FIXME(inherent_associated_types): Enhancement: Spruce up the diagnostic by saying something like +// "implementation is not general enough" as is done for traits via +// `try_report_trait_placeholder_mismatch`. + +fn bar(_: Foo fn(&'a ())>::Assoc) {} +//~^ ERROR mismatched types +//~| ERROR mismatched types + +fn main() {} diff --git a/tests/ui/associated-inherent-types/issue-109789.stderr b/tests/ui/associated-inherent-types/issue-109789.stderr new file mode 100644 index 000000000000..7af338274a12 --- /dev/null +++ b/tests/ui/associated-inherent-types/issue-109789.stderr @@ -0,0 +1,21 @@ +error[E0308]: mismatched types + --> $DIR/issue-109789.rs:18:1 + | +LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected struct `Foo` + found struct `Foo fn(&'a ())>` + +error[E0308]: mismatched types + --> $DIR/issue-109789.rs:18:11 + | +LL | fn bar(_: Foo fn(&'a ())>::Assoc) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ one type is more general than the other + | + = note: expected struct `Foo` + found struct `Foo fn(&'a ())>` + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/associated-inherent-types/issue-109790.rs b/tests/ui/associated-inherent-types/issue-109790.rs new file mode 100644 index 000000000000..b2be19a28f44 --- /dev/null +++ b/tests/ui/associated-inherent-types/issue-109790.rs @@ -0,0 +1,17 @@ +// check-pass + +#![feature(inherent_associated_types)] +#![allow(incomplete_features)] + +struct Foo(T); + +impl<'a> Foo { + type Assoc = &'a (); +} + +trait Other {} +impl Other for u32 {} + +fn bar(_: for<'a> fn(Foo::Assoc)) {} + +fn main() {} From 61e1eda6db042413cf1794407fd10b7edc90059d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Wed, 29 Mar 2023 03:24:35 +0200 Subject: [PATCH 11/97] IAT: Rustdoc integration --- src/librustdoc/clean/auto_trait.rs | 5 +- src/librustdoc/clean/inline.rs | 7 ++- src/librustdoc/clean/mod.rs | 60 ++++++++++++++----- src/librustdoc/clean/types.rs | 4 +- src/librustdoc/html/format.rs | 46 ++++++++++---- src/librustdoc/html/render/mod.rs | 4 +- src/librustdoc/json/conversions.rs | 2 +- src/rustdoc-json-types/lib.rs | 8 ++- src/tools/jsondoclint/src/validator.rs | 4 +- tests/rustdoc/inherent-projections.rs | 38 ++++++++++-- .../intra-doc/inherent-associated-types.rs | 45 ++++++++++++++ 11 files changed, 183 insertions(+), 40 deletions(-) create mode 100644 tests/rustdoc/intra-doc/inherent-associated-types.rs diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index fb32b6ef1d3f..baf2b0a85852 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -556,7 +556,10 @@ where WherePredicate::EqPredicate { lhs, rhs, bound_params } => { match *lhs { Type::QPath(box QPathData { - ref assoc, ref self_type, ref trait_, .. + ref assoc, + ref self_type, + trait_: Some(ref trait_), + .. }) => { let ty = &*self_type; let mut new_trait = trait_.clone(); diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 951f54e93663..c852f9cca2bf 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -706,7 +706,12 @@ fn filter_non_trait_generics(trait_did: DefId, mut g: clean::Generics) -> clean: g.where_predicates.retain(|pred| match pred { clean::WherePredicate::BoundPredicate { - ty: clean::QPath(box clean::QPathData { self_type: clean::Generic(ref s), trait_, .. }), + ty: + clean::QPath(box clean::QPathData { + self_type: clean::Generic(ref s), + trait_: Some(trait_), + .. + }), bounds, .. } => !(bounds.is_empty() || *s == kw::SelfUpper && trait_.def_id() == trait_did), diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 72b60d95b8c1..657f3c9ec457 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -441,7 +441,7 @@ fn clean_projection<'tcx>( assoc: projection_to_path_segment(ty, cx), should_show_cast, self_type, - trait_, + trait_: Some(trait_), })) } @@ -1330,7 +1330,13 @@ pub(crate) fn clean_middle_assoc_item<'tcx>( let mut bounds: Vec = Vec::new(); generics.where_predicates.retain_mut(|pred| match *pred { WherePredicate::BoundPredicate { - ty: QPath(box QPathData { ref assoc, ref self_type, ref trait_, .. }), + ty: + QPath(box QPathData { + ref assoc, + ref self_type, + trait_: Some(ref trait_), + .. + }), bounds: ref mut pred_bounds, .. } => { @@ -1492,25 +1498,30 @@ fn clean_qpath<'tcx>(hir_ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> Type assoc: clean_path_segment(p.segments.last().expect("segments were empty"), cx), should_show_cast, self_type, - trait_, + trait_: Some(trait_), })) } hir::QPath::TypeRelative(qself, segment) => { let ty = hir_ty_to_ty(cx.tcx, hir_ty); - let res = match ty.kind() { + let self_type = clean_ty(qself, cx); + + let (trait_, should_show_cast) = match ty.kind() { ty::Alias(ty::Projection, proj) => { - Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id) + let res = Res::Def(DefKind::Trait, proj.trait_ref(cx.tcx).def_id); + let trait_ = clean_path(&hir::Path { span, res, segments: &[] }, cx); + register_res(cx, trait_.res); + let self_def_id = res.opt_def_id(); + let should_show_cast = + compute_should_show_cast(self_def_id, &trait_, &self_type); + + (Some(trait_), should_show_cast) } + ty::Alias(ty::Inherent, _) => (None, false), // Rustdoc handles `ty::Error`s by turning them into `Type::Infer`s. ty::Error(_) => return Type::Infer, - // Otherwise, this is an inherent associated type. - _ => return clean_middle_ty(ty::Binder::dummy(ty), cx, None), + _ => bug!("clean: expected associated type, found `{ty:?}`"), }; - let trait_ = clean_path(&hir::Path { span, res, segments: &[] }, cx); - register_res(cx, trait_.res); - let self_def_id = res.opt_def_id(); - let self_type = clean_ty(qself, cx); - let should_show_cast = compute_should_show_cast(self_def_id, &trait_, &self_type); + Type::QPath(Box::new(QPathData { assoc: clean_path_segment(segment, cx), should_show_cast, @@ -1836,9 +1847,28 @@ pub(crate) fn clean_middle_ty<'tcx>( clean_projection(bound_ty.rebind(*data), cx, parent_def_id) } - // FIXME(fmease): Clean inherent projections properly. This requires making the trait ref in - // `QPathData` optional or alternatively adding a new `clean::Type` variant. - ty::Alias(ty::Inherent, _data) => Type::Infer, + ty::Alias(ty::Inherent, alias_ty) => { + let alias_ty = bound_ty.rebind(alias_ty); + let self_type = clean_middle_ty(alias_ty.map_bound(|ty| ty.self_ty()), cx, None); + + Type::QPath(Box::new(QPathData { + assoc: PathSegment { + name: cx.tcx.associated_item(alias_ty.skip_binder().def_id).name, + args: GenericArgs::AngleBracketed { + args: substs_to_args( + cx, + alias_ty.map_bound(|ty| ty.substs.as_slice()), + true, + ) + .into(), + bindings: Default::default(), + }, + }, + should_show_cast: false, + self_type, + trait_: None, + })) + } ty::Param(ref p) => { if let Some(bounds) = cx.impl_trait_bounds.remove(&p.index.into()) { diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 7371b44465ba..38664c3e359a 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -1660,7 +1660,7 @@ impl Type { pub(crate) fn projection(&self) -> Option<(&Type, DefId, PathSegment)> { if let QPath(box QPathData { self_type, trait_, assoc, .. }) = self { - Some((self_type, trait_.def_id(), assoc.clone())) + Some((self_type, trait_.as_ref()?.def_id(), assoc.clone())) } else { None } @@ -1704,7 +1704,7 @@ pub(crate) struct QPathData { pub self_type: Type, /// FIXME: compute this field on demand. pub should_show_cast: bool, - pub trait_: Path, + pub trait_: Option, } /// A primitive (aka, builtin) type. diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 1c6810bdaf9b..d963d6092c48 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -1116,14 +1116,17 @@ fn fmt_type<'cx>( ref trait_, should_show_cast, }) => { + // FIXME(inherent_associated_types): Once we support non-ADT self-types (#106719), + // we need to surround them with angle brackets in some cases (e.g. `::P`). + if f.alternate() { - if should_show_cast { + if let Some(trait_) = trait_ && should_show_cast { write!(f, "<{:#} as {:#}>::", self_type.print(cx), trait_.print(cx))? } else { write!(f, "{:#}::", self_type.print(cx))? } } else { - if should_show_cast { + if let Some(trait_) = trait_ && should_show_cast { write!(f, "<{} as {}>::", self_type.print(cx), trait_.print(cx))? } else { write!(f, "{}::", self_type.print(cx))? @@ -1139,15 +1142,36 @@ fn fmt_type<'cx>( // the ugliness comes from inlining across crates where // everything comes in as a fully resolved QPath (hard to // look at). - if !f.alternate() && let Ok((url, _, path)) = href(trait_.def_id(), cx) { - write!( - f, - "{name}", - shortty = ItemType::AssocType, - name = assoc.name, - path = join_with_double_colon(&path), - ) + if !f.alternate() { + // FIXME(inherent_associated_types): We always link to the very first associated + // type (in respect to source order) that bears the given name (`assoc.name`) and that is + // affiliated with the computed `DefId`. This is obviously incorrect when we have + // multiple impl blocks. Ideally, we would thread the `DefId` of the assoc ty itself + // through here and map it to the corresponding HTML ID that was generated by + // `render::Context::derive_id` when the impl blocks were rendered. + // There is no such mapping unfortunately. + // As a hack, we could badly imitate `derive_id` here by keeping *count* when looking + // for the assoc ty `DefId` in `tcx.associated_items(self_ty_did).in_definition_order()` + // considering privacy, `doc(hidden)`, etc. + // I don't feel like that right now :cold_sweat:. + + let parent_href = match trait_ { + Some(trait_) => href(trait_.def_id(), cx).ok(), + None => self_type.def_id(cx.cache()).and_then(|did| href(did, cx).ok()), + }; + + if let Some((url, _, path)) = parent_href { + write!( + f, + "{name}", + shortty = ItemType::AssocType, + name = assoc.name, + path = join_with_double_colon(&path), + ) + } else { + write!(f, "{}", assoc.name) + } } else { write!(f, "{}", assoc.name) }?; diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index e09c6480060d..d6773169639c 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -2202,7 +2202,9 @@ fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec { } clean::Type::QPath(box clean::QPathData { self_type, trait_, .. }) => { work.push_back(self_type); - process_path(trait_.def_id()); + if let Some(trait_) = trait_ { + process_path(trait_.def_id()); + } } _ => {} } diff --git a/src/librustdoc/json/conversions.rs b/src/librustdoc/json/conversions.rs index b5bebb705938..b1cef20b434a 100644 --- a/src/librustdoc/json/conversions.rs +++ b/src/librustdoc/json/conversions.rs @@ -574,7 +574,7 @@ impl FromWithTcx for Type { name: assoc.name.to_string(), args: Box::new(assoc.args.into_tcx(tcx)), self_type: Box::new(self_type.into_tcx(tcx)), - trait_: trait_.into_tcx(tcx), + trait_: trait_.map(|trait_| trait_.into_tcx(tcx)), }, } } diff --git a/src/rustdoc-json-types/lib.rs b/src/rustdoc-json-types/lib.rs index 3cf8ceed6203..3556834071fc 100644 --- a/src/rustdoc-json-types/lib.rs +++ b/src/rustdoc-json-types/lib.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; use std::path::PathBuf; /// rustdoc format-version. -pub const FORMAT_VERSION: u32 = 24; +pub const FORMAT_VERSION: u32 = 25; /// A `Crate` is the root of the emitted JSON blob. It contains all type/documentation information /// about the language items in the local crate, as well as info about external items to allow @@ -581,13 +581,15 @@ pub enum Type { #[serde(rename = "type")] type_: Box, }, - /// `::Name` or associated types like `T::Item` where `T: Iterator` + /// Associated types like `::Name` and `T::Item` where + /// `T: Iterator` or inherent associated types like `Struct::Name`. QualifiedPath { name: String, args: Box, self_type: Box, + /// `None` iff this is an *inherent* associated type. #[serde(rename = "trait")] - trait_: Path, + trait_: Option, }, } diff --git a/src/tools/jsondoclint/src/validator.rs b/src/tools/jsondoclint/src/validator.rs index a1f675a3b40f..bf8a64acf08d 100644 --- a/src/tools/jsondoclint/src/validator.rs +++ b/src/tools/jsondoclint/src/validator.rs @@ -273,7 +273,9 @@ impl<'a> Validator<'a> { Type::QualifiedPath { name: _, args, self_type, trait_ } => { self.check_generic_args(&**args); self.check_type(&**self_type); - self.check_path(trait_, PathKind::Trait); + if let Some(trait_) = trait_ { + self.check_path(trait_, PathKind::Trait); + } } } } diff --git a/tests/rustdoc/inherent-projections.rs b/tests/rustdoc/inherent-projections.rs index bdd881ab456d..9bda0acaf83f 100644 --- a/tests/rustdoc/inherent-projections.rs +++ b/tests/rustdoc/inherent-projections.rs @@ -1,10 +1,9 @@ #![feature(inherent_associated_types)] #![allow(incomplete_features)] -// FIXME(fmease): Properly render inherent projections. - -// @has inherent_projections/fn.create.html -// @has - '//pre[@class="rust item-decl"]' "create() -> _" +// @has 'inherent_projections/fn.create.html' +// @has - '//pre[@class="rust item-decl"]' "create() -> Owner::Metadata" +// @has - '//pre[@class="rust item-decl"]//a[@class="associatedtype"]/@href' 'struct.Owner.html#associatedtype.Metadata' pub fn create() -> Owner::Metadata {} pub struct Owner; @@ -12,3 +11,34 @@ pub struct Owner; impl Owner { pub type Metadata = (); } + +// Make sure we handle bound vars correctly. +// @has 'inherent_projections/type.User.html' '//pre[@class="rust item-decl"]' "for<'a> fn(_: Carrier<'a>::Focus)" +pub type User = for<'a> fn(Carrier<'a>::Focus); + +pub struct Carrier<'a>(&'a ()); + +impl<'a> Carrier<'a> { + pub type Focus = &'a mut i32; +} + +//////////////////////////////////////// + +// FIXME(inherent_associated_types): Below we link to `Proj` but we should link to `Proj-1`. +// The current test checks for the buggy behavior for demonstration purposes. + +// @has 'inherent_projections/type.Test.html' +// @has - '//pre[@class="rust item-decl"]' "Parametrized" +// @has - '//pre[@class="rust item-decl"]//a[@class="associatedtype"]/@href' 'struct.Parametrized.html#associatedtype.Proj' +// @!has - '//pre[@class="rust item-decl"]//a[@class="associatedtype"]/@href' 'struct.Parametrized.html#associatedtype.Proj-1' +pub type Test = Parametrized::Proj; + +pub struct Parametrized(T); + +impl Parametrized { + pub type Proj = (); +} + +impl Parametrized { + pub type Proj = String; +} diff --git a/tests/rustdoc/intra-doc/inherent-associated-types.rs b/tests/rustdoc/intra-doc/inherent-associated-types.rs new file mode 100644 index 000000000000..2b28d2ae60bd --- /dev/null +++ b/tests/rustdoc/intra-doc/inherent-associated-types.rs @@ -0,0 +1,45 @@ +#![feature(inherent_associated_types)] + +#![allow(incomplete_features)] +#![deny(rustdoc::broken_intra_doc_links)] + +// @has inherent_associated_types/index.html + +// @has - '//a/@href' 'enum.Simple.html#associatedtype.Type' +//! [`Simple::Type`] + +pub enum Simple {} + +impl Simple { + pub type Type = (); +} + +//////////////////////////////////////// + +// @has 'inherent_associated_types/type.Test0.html' '//a/@href' \ +// 'struct.Parametrized.html#associatedtype.Proj' +/// [`Parametrized::Proj`] +pub type Test0 = (); + +// FIXME(inherent_associated_types): The intra-doc link below should point to `Proj-1` not `Proj`. +// The current test checks for the buggy behavior for demonstration purposes. +// The same bug happens for inherent associated functions and constants (see #85960, #93398). +// +// Further, at some point we should reject the intra-doc link `Parametrized::Proj`. +// It currently links to `Parametrized::Proj`. + +// @has 'inherent_associated_types/type.Test1.html' +// @has - '//a/@href' 'struct.Parametrized.html#associatedtype.Proj' +// @!has - '//a/@href' 'struct.Parametrized.html#associatedtype.Proj-1' +/// [`Parametrized::Proj`] +pub type Test1 = (); + +pub struct Parametrized(T); + +impl Parametrized { + pub type Proj = (); +} + +impl Parametrized { + pub type Proj = String; +} From cd6dec33c2b484fbcb672cb1f80b68b602c1a6f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Le=C3=B3n=20Orell=20Valerian=20Liehr?= Date: Fri, 21 Apr 2023 22:02:41 +0200 Subject: [PATCH 12/97] IAT: Proper WF computation --- .../src/traits/project.rs | 66 +++++++++----- .../rustc_trait_selection/src/traits/wf.rs | 87 ++++++++++++------- 2 files changed, 99 insertions(+), 54 deletions(-) diff --git a/compiler/rustc_trait_selection/src/traits/project.rs b/compiler/rustc_trait_selection/src/traits/project.rs index 852780fccace..8e684b7ac239 100644 --- a/compiler/rustc_trait_selection/src/traits/project.rs +++ b/compiler/rustc_trait_selection/src/traits/project.rs @@ -1274,29 +1274,14 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>( }); } - let impl_def_id = tcx.parent(alias_ty.def_id); - let impl_substs = selcx.infcx.fresh_substs_for_item(cause.span, impl_def_id); - - let impl_ty = tcx.type_of(impl_def_id).subst(tcx, impl_substs); - let impl_ty = - normalize_with_depth_to(selcx, param_env, cause.clone(), depth + 1, impl_ty, obligations); - - // Infer the generic parameters of the impl by unifying the - // impl type with the self type of the projection. - let self_ty = alias_ty.self_ty(); - match selcx.infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, impl_ty, self_ty) { - Ok(mut ok) => obligations.append(&mut ok.obligations), - Err(_) => { - tcx.sess.delay_span_bug( - cause.span, - format!( - "{self_ty:?} was a subtype of {impl_ty:?} during selection but now it is not" - ), - ); - } - } - - let substs = alias_ty.rebase_substs_onto_impl(impl_substs, tcx); + let substs = compute_inherent_assoc_ty_substs( + selcx, + param_env, + alias_ty, + cause.clone(), + depth, + obligations, + ); // Register the obligations arising from the impl and from the associated type itself. let predicates = tcx.predicates_of(alias_ty.def_id).instantiate(tcx, substs); @@ -1343,6 +1328,41 @@ pub fn normalize_inherent_projection<'a, 'b, 'tcx>( ty } +pub fn compute_inherent_assoc_ty_substs<'a, 'b, 'tcx>( + selcx: &'a mut SelectionContext<'b, 'tcx>, + param_env: ty::ParamEnv<'tcx>, + alias_ty: ty::AliasTy<'tcx>, + cause: ObligationCause<'tcx>, + depth: usize, + obligations: &mut Vec>, +) -> ty::SubstsRef<'tcx> { + let tcx = selcx.tcx(); + + let impl_def_id = tcx.parent(alias_ty.def_id); + let impl_substs = selcx.infcx.fresh_substs_for_item(cause.span, impl_def_id); + + let impl_ty = tcx.type_of(impl_def_id).subst(tcx, impl_substs); + let impl_ty = + normalize_with_depth_to(selcx, param_env, cause.clone(), depth + 1, impl_ty, obligations); + + // Infer the generic parameters of the impl by unifying the + // impl type with the self type of the projection. + let self_ty = alias_ty.self_ty(); + match selcx.infcx.at(&cause, param_env).eq(DefineOpaqueTypes::No, impl_ty, self_ty) { + Ok(mut ok) => obligations.append(&mut ok.obligations), + Err(_) => { + tcx.sess.delay_span_bug( + cause.span, + format!( + "{self_ty:?} was a subtype of {impl_ty:?} during selection but now it is not" + ), + ); + } + } + + alias_ty.rebase_substs_onto_impl(impl_substs, tcx) +} + enum Projected<'tcx> { Progress(Progress<'tcx>), NoProgress(ty::Term<'tcx>), diff --git a/compiler/rustc_trait_selection/src/traits/wf.rs b/compiler/rustc_trait_selection/src/traits/wf.rs index e5edceda9444..086ab32b5200 100644 --- a/compiler/rustc_trait_selection/src/traits/wf.rs +++ b/compiler/rustc_trait_selection/src/traits/wf.rs @@ -58,15 +58,8 @@ pub fn obligations<'tcx>( GenericArgKind::Lifetime(..) => return Some(Vec::new()), }; - let mut wf = WfPredicates { - tcx: infcx.tcx, - param_env, - body_id, - span, - out: vec![], - recursion_depth, - item: None, - }; + let mut wf = + WfPredicates { infcx, param_env, body_id, span, out: vec![], recursion_depth, item: None }; wf.compute(arg); debug!("wf::obligations({:?}, body_id={:?}) = {:?}", arg, body_id, wf.out); @@ -91,7 +84,7 @@ pub fn unnormalized_obligations<'tcx>( debug_assert_eq!(arg, infcx.resolve_vars_if_possible(arg)); let mut wf = WfPredicates { - tcx: infcx.tcx, + infcx, param_env, body_id: CRATE_DEF_ID, span: DUMMY_SP, @@ -116,7 +109,7 @@ pub fn trait_obligations<'tcx>( item: &'tcx hir::Item<'tcx>, ) -> Vec> { let mut wf = WfPredicates { - tcx: infcx.tcx, + infcx, param_env, body_id, span, @@ -138,7 +131,7 @@ pub fn predicate_obligations<'tcx>( span: Span, ) -> Vec> { let mut wf = WfPredicates { - tcx: infcx.tcx, + infcx, param_env, body_id, span, @@ -190,8 +183,8 @@ pub fn predicate_obligations<'tcx>( wf.normalize(infcx) } -struct WfPredicates<'tcx> { - tcx: TyCtxt<'tcx>, +struct WfPredicates<'a, 'tcx> { + infcx: &'a InferCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, body_id: LocalDefId, span: Span, @@ -290,9 +283,9 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>( } } -impl<'tcx> WfPredicates<'tcx> { +impl<'a, 'tcx> WfPredicates<'a, 'tcx> { fn tcx(&self) -> TyCtxt<'tcx> { - self.tcx + self.infcx.tcx } fn cause(&self, code: traits::ObligationCauseCode<'tcx>) -> traits::ObligationCause<'tcx> { @@ -325,7 +318,7 @@ impl<'tcx> WfPredicates<'tcx> { /// Pushes the obligations required for `trait_ref` to be WF into `self.out`. fn compute_trait_pred(&mut self, trait_pred: &ty::TraitPredicate<'tcx>, elaborate: Elaborate) { - let tcx = self.tcx; + let tcx = self.tcx(); let trait_ref = &trait_pred.trait_ref; // Negative trait predicates don't require supertraits to hold, just @@ -369,7 +362,6 @@ impl<'tcx> WfPredicates<'tcx> { self.out.extend(obligations); } - let tcx = self.tcx(); self.out.extend( trait_ref .substs @@ -436,13 +428,45 @@ impl<'tcx> WfPredicates<'tcx> { let obligations = self.nominal_obligations_without_const(data.def_id, data.substs); self.out.extend(obligations); + self.compute_projection_substs(data.substs); + } + + fn compute_inherent_projection(&mut self, data: ty::AliasTy<'tcx>) { + // An inherent projection is well-formed if + // + // (a) its predicates hold (*) + // (b) its substs are wf + // + // (*) The predicates of an inherent associated type include the + // predicates of the impl that it's contained in. + + if !data.self_ty().has_escaping_bound_vars() { + // FIXME(inherent_associated_types): Should this happen inside of a snapshot? + // FIXME(inherent_associated_types): This is incompatible with the new solver and lazy norm! + let substs = traits::project::compute_inherent_assoc_ty_substs( + &mut traits::SelectionContext::new(self.infcx), + self.param_env, + data, + self.cause(traits::WellFormed(None)), + self.recursion_depth, + &mut self.out, + ); + // Inherent projection types do not require const predicates. + let obligations = self.nominal_obligations_without_const(data.def_id, substs); + self.out.extend(obligations); + } + + self.compute_projection_substs(data.substs); + } + + fn compute_projection_substs(&mut self, substs: SubstsRef<'tcx>) { let tcx = self.tcx(); let cause = self.cause(traits::WellFormed(None)); let param_env = self.param_env; let depth = self.recursion_depth; self.out.extend( - data.substs + substs .iter() .filter(|arg| { matches!(arg.unpack(), GenericArgKind::Type(..) | GenericArgKind::Const(..)) @@ -464,9 +488,9 @@ impl<'tcx> WfPredicates<'tcx> { if !subty.has_escaping_bound_vars() { let cause = self.cause(cause); let trait_ref = - ty::TraitRef::from_lang_item(self.tcx, LangItem::Sized, cause.span, [subty]); + ty::TraitRef::from_lang_item(self.tcx(), LangItem::Sized, cause.span, [subty]); self.out.push(traits::Obligation::with_depth( - self.tcx, + self.tcx(), cause, self.recursion_depth, self.param_env, @@ -605,8 +629,9 @@ impl<'tcx> WfPredicates<'tcx> { walker.skip_current_subtree(); // Subtree handled by compute_projection. self.compute_projection(data); } - ty::Alias(ty::Inherent, _) => { - // WF if their substs are WF. + ty::Alias(ty::Inherent, data) => { + walker.skip_current_subtree(); // Subtree handled by compute_inherent_projection. + self.compute_inherent_projection(data); } ty::Adt(def, substs) => { @@ -700,7 +725,7 @@ impl<'tcx> WfPredicates<'tcx> { // All of the requirements on type parameters // have already been checked for `impl Trait` in // return position. We do need to check type-alias-impl-trait though. - if self.tcx.is_type_alias_impl_trait(def_id) { + if self.tcx().is_type_alias_impl_trait(def_id) { let obligations = self.nominal_obligations(def_id, substs); self.out.extend(obligations); } @@ -770,15 +795,15 @@ impl<'tcx> WfPredicates<'tcx> { substs: SubstsRef<'tcx>, remap_constness: bool, ) -> Vec> { - let predicates = self.tcx.predicates_of(def_id); + let predicates = self.tcx().predicates_of(def_id); let mut origins = vec![def_id; predicates.predicates.len()]; let mut head = predicates; while let Some(parent) = head.parent { - head = self.tcx.predicates_of(parent); + head = self.tcx().predicates_of(parent); origins.extend(iter::repeat(parent).take(head.predicates.len())); } - let predicates = predicates.instantiate(self.tcx, substs); + let predicates = predicates.instantiate(self.tcx(), substs); trace!("{:#?}", predicates); debug_assert_eq!(predicates.predicates.len(), origins.len()); @@ -791,10 +816,10 @@ impl<'tcx> WfPredicates<'tcx> { }; let cause = self.cause(code); if remap_constness { - pred = pred.without_const(self.tcx); + pred = pred.without_const(self.tcx()); } traits::Obligation::with_depth( - self.tcx, + self.tcx(), cause, self.recursion_depth, self.param_env, @@ -859,7 +884,7 @@ impl<'tcx> WfPredicates<'tcx> { // Note: in fact we only permit builtin traits, not `Bar<'d>`, I // am looking forward to the future here. if !data.has_escaping_bound_vars() && !region.has_escaping_bound_vars() { - let implicit_bounds = object_region_bounds(self.tcx, data); + let implicit_bounds = object_region_bounds(self.tcx(), data); let explicit_bound = region; @@ -869,7 +894,7 @@ impl<'tcx> WfPredicates<'tcx> { let outlives = ty::Binder::dummy(ty::OutlivesPredicate(explicit_bound, implicit_bound)); self.out.push(traits::Obligation::with_depth( - self.tcx, + self.tcx(), cause, self.recursion_depth, self.param_env, From 930eece9d34b67533cf3d27c06253e806a5add0f Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Thu, 4 May 2023 17:24:13 +0000 Subject: [PATCH 13/97] Don't compute trait super bounds unless they're positive --- .../rustc_hir_analysis/src/collect/predicates_of.rs | 11 ++++++----- tests/ui/traits/negative-bounds/supertrait.rs | 9 +++++++++ tests/ui/traits/negative-bounds/supertrait.stderr | 10 ++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 tests/ui/traits/negative-bounds/supertrait.rs create mode 100644 tests/ui/traits/negative-bounds/supertrait.stderr diff --git a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs index 83470342a766..c1e12b554e94 100644 --- a/compiler/rustc_hir_analysis/src/collect/predicates_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/predicates_of.rs @@ -657,14 +657,15 @@ pub(super) fn implied_predicates_with_filter( &*tcx.arena.alloc_from_iter(superbounds.predicates().chain(where_bounds_that_match)); debug!(?implied_bounds); - // Now require that immediate supertraits are converted, - // which will, in turn, reach indirect supertraits. + // Now require that immediate supertraits are converted, which will, in + // turn, reach indirect supertraits, so we detect cycles now instead of + // overflowing during elaboration. if matches!(filter, PredicateFilter::SelfOnly) { - // Now require that immediate supertraits are converted, - // which will, in turn, reach indirect supertraits. for &(pred, span) in implied_bounds { debug!("superbound: {:?}", pred); - if let ty::PredicateKind::Clause(ty::Clause::Trait(bound)) = pred.kind().skip_binder() { + if let ty::PredicateKind::Clause(ty::Clause::Trait(bound)) = pred.kind().skip_binder() + && bound.polarity == ty::ImplPolarity::Positive + { tcx.at(span).super_predicates_of(bound.def_id()); } } diff --git a/tests/ui/traits/negative-bounds/supertrait.rs b/tests/ui/traits/negative-bounds/supertrait.rs new file mode 100644 index 000000000000..df0884b8b9f1 --- /dev/null +++ b/tests/ui/traits/negative-bounds/supertrait.rs @@ -0,0 +1,9 @@ +// check-pass + +#![feature(negative_bounds)] +//~^ WARN the feature `negative_bounds` is incomplete + +trait A: !B {} +trait B: !A {} + +fn main() {} diff --git a/tests/ui/traits/negative-bounds/supertrait.stderr b/tests/ui/traits/negative-bounds/supertrait.stderr new file mode 100644 index 000000000000..f44753b624e3 --- /dev/null +++ b/tests/ui/traits/negative-bounds/supertrait.stderr @@ -0,0 +1,10 @@ +warning: the feature `negative_bounds` is incomplete and may not be safe to use and/or cause compiler crashes + --> $DIR/supertrait.rs:3:12 + | +LL | #![feature(negative_bounds)] + | ^^^^^^^^^^^^^^^ + | + = note: `#[warn(incomplete_features)]` on by default + +warning: 1 warning emitted + From a427d418fd0004f12a7d59899e6994238daed9aa Mon Sep 17 00:00:00 2001 From: BlackHoleFox Date: Mon, 5 Dec 2022 23:15:16 -0600 Subject: [PATCH 14/97] Add deployment-target --print flag for Apple targets --- compiler/rustc_driver_impl/src/lib.rs | 16 +++++++ compiler/rustc_session/src/config.rs | 4 +- compiler/rustc_target/src/spec/apple_base.rs | 42 ++++++++++++++----- compiler/rustc_target/src/spec/mod.rs | 1 + src/doc/rustc/src/command-line-arguments.md | 6 +++ src/tools/tidy/src/ui_tests.rs | 2 +- .../valid-print-requests.stderr | 2 +- tests/ui/deployment-target/invalid-target.rs | 4 ++ .../deployment-target/invalid-target.stderr | 2 + tests/ui/deployment-target/macos-target.rs | 7 ++++ .../ui/deployment-target/macos-target.stdout | 1 + 11 files changed, 73 insertions(+), 14 deletions(-) create mode 100644 tests/ui/deployment-target/invalid-target.rs create mode 100644 tests/ui/deployment-target/invalid-target.stderr create mode 100644 tests/ui/deployment-target/macos-target.rs create mode 100644 tests/ui/deployment-target/macos-target.stdout diff --git a/compiler/rustc_driver_impl/src/lib.rs b/compiler/rustc_driver_impl/src/lib.rs index 5fac485de641..b9fb944b0c69 100644 --- a/compiler/rustc_driver_impl/src/lib.rs +++ b/compiler/rustc_driver_impl/src/lib.rs @@ -745,6 +745,22 @@ fn print_crate_info( } } } + DeploymentTarget => { + use rustc_target::spec::current_apple_deployment_target; + + if sess.target.is_like_osx { + safe_println!( + "deployment_target={}", + current_apple_deployment_target(&sess.target) + .expect("unknown Apple target OS") + ) + } else { + early_error( + ErrorOutputType::default(), + "only Apple targets currently support deployment version info", + ) + } + } } } Compilation::Stop diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs index cfdba1120ec3..a398c70c9a06 100644 --- a/compiler/rustc_session/src/config.rs +++ b/compiler/rustc_session/src/config.rs @@ -587,6 +587,7 @@ pub enum PrintRequest { StackProtectorStrategies, LinkArgs, SplitDebuginfo, + DeploymentTarget, } #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)] @@ -1452,7 +1453,7 @@ pub fn rustc_short_optgroups() -> Vec { "[crate-name|file-names|sysroot|target-libdir|cfg|calling-conventions|\ target-list|target-cpus|target-features|relocation-models|code-models|\ tls-models|target-spec-json|all-target-specs-json|native-static-libs|\ - stack-protector-strategies|link-args]", + stack-protector-strategies|link-args|deployment-target]", ), opt::flagmulti_s("g", "", "Equivalent to -C debuginfo=2"), opt::flagmulti_s("O", "", "Equivalent to -C opt-level=2"), @@ -1902,6 +1903,7 @@ fn collect_print_requests( ("all-target-specs-json", PrintRequest::AllTargetSpecs), ("link-args", PrintRequest::LinkArgs), ("split-debuginfo", PrintRequest::SplitDebuginfo), + ("deployment-target", PrintRequest::DeploymentTarget), ]; prints.extend(matches.opt_strs("print").into_iter().map(|req| { diff --git a/compiler/rustc_target/src/spec/apple_base.rs b/compiler/rustc_target/src/spec/apple_base.rs index 4c7f64b20785..ff2246318288 100644 --- a/compiler/rustc_target/src/spec/apple_base.rs +++ b/compiler/rustc_target/src/spec/apple_base.rs @@ -1,7 +1,7 @@ use std::{borrow::Cow, env}; use crate::spec::{cvs, Cc, DebuginfoKind, FramePointer, LinkArgs}; -use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, TargetOptions}; +use crate::spec::{LinkerFlavor, Lld, SplitDebuginfo, StaticCow, Target, TargetOptions}; #[cfg(test)] #[path = "apple/tests.rs"] @@ -179,12 +179,28 @@ pub fn opts(os: &'static str, arch: Arch) -> TargetOptions { } } -fn deployment_target(var_name: &str) -> Option<(u32, u32)> { - let deployment_target = env::var(var_name).ok(); - deployment_target - .as_ref() - .and_then(|s| s.split_once('.')) - .and_then(|(a, b)| a.parse::().and_then(|a| b.parse::().map(|b| (a, b))).ok()) +pub fn deployment_target(target: &Target) -> Option { + let (major, minor) = match &*target.os { + "macos" => { + // This does not need to be specific. It just needs to handle x86 vs M1. + let arch = if target.arch == "x86" || target.arch == "x86_64" { X86_64 } else { Arm64 }; + macos_deployment_target(arch) + } + "ios" => ios_deployment_target(), + "watchos" => watchos_deployment_target(), + "tvos" => tvos_deployment_target(), + _ => return None, + }; + + Some(format!("{major}.{minor}")) +} + +fn from_set_deployment_target(var_name: &str) -> Option<(u32, u32)> { + let deployment_target = env::var(var_name).ok()?; + let (unparsed_major, unparsed_minor) = deployment_target.split_once('.')?; + let (major, minor) = (unparsed_major.parse().ok()?, unparsed_minor.parse().ok()?); + + Some((major, minor)) } fn macos_default_deployment_target(arch: Arch) -> (u32, u32) { @@ -198,7 +214,8 @@ fn macos_default_deployment_target(arch: Arch) -> (u32, u32) { } fn macos_deployment_target(arch: Arch) -> (u32, u32) { - deployment_target("MACOSX_DEPLOYMENT_TARGET") + // If you are looking for the default deployment target, prefer `rustc --print deployment-target`. + from_set_deployment_target("MACOSX_DEPLOYMENT_TARGET") .unwrap_or_else(|| macos_default_deployment_target(arch)) } @@ -247,7 +264,8 @@ fn link_env_remove(arch: Arch, os: &'static str) -> StaticCow<[StaticCow]> } fn ios_deployment_target() -> (u32, u32) { - deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) + // If you are looking for the default deployment target, prefer `rustc --print deployment-target`. + from_set_deployment_target("IPHONEOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) } pub fn ios_llvm_target(arch: Arch) -> String { @@ -272,7 +290,8 @@ pub fn ios_sim_llvm_target(arch: Arch) -> String { } fn tvos_deployment_target() -> (u32, u32) { - deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) + // If you are looking for the default deployment target, prefer `rustc --print deployment-target`. + from_set_deployment_target("TVOS_DEPLOYMENT_TARGET").unwrap_or((7, 0)) } fn tvos_lld_platform_version() -> String { @@ -281,7 +300,8 @@ fn tvos_lld_platform_version() -> String { } fn watchos_deployment_target() -> (u32, u32) { - deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0)) + // If you are looking for the default deployment target, prefer `rustc --print deployment-target`. + from_set_deployment_target("WATCHOS_DEPLOYMENT_TARGET").unwrap_or((5, 0)) } fn watchos_lld_platform_version() -> String { diff --git a/compiler/rustc_target/src/spec/mod.rs b/compiler/rustc_target/src/spec/mod.rs index 10d38c34919c..ba4b89c9ea10 100644 --- a/compiler/rustc_target/src/spec/mod.rs +++ b/compiler/rustc_target/src/spec/mod.rs @@ -60,6 +60,7 @@ pub mod crt_objects; mod aix_base; mod android_base; mod apple_base; +pub use apple_base::deployment_target as current_apple_deployment_target; mod avr_gnu_base; mod bpf_base; mod dragonfly_base; diff --git a/src/doc/rustc/src/command-line-arguments.md b/src/doc/rustc/src/command-line-arguments.md index d4d26654ed11..3be4382b0a3a 100644 --- a/src/doc/rustc/src/command-line-arguments.md +++ b/src/doc/rustc/src/command-line-arguments.md @@ -248,8 +248,14 @@ The valid types of print values are: exact format of this debugging output is not a stable guarantee, other than that it will include the linker executable and the text of each command-line argument passed to the linker. +- `deployment-target` - The currently selected [deployment target] (or minimum OS version) + for the selected Apple platform target. This value can be used or passed along to other + components alongside a Rust build that need this information, such as C compilers. + This returns rustc's minimum supported deployment target if no `*_DEPLOYMENT_TARGET` variable + is present in the environment, or otherwise returns the variable's parsed value. [conditional compilation]: ../reference/conditional-compilation.html +[deployment target]: https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/cross_development/Configuring/configuring.html ## `-g`: include debug information diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index a2f7b8ba7be3..e4f328ec0ddc 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -10,7 +10,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. const ISSUES_ENTRY_LIMIT: usize = 1953; -const ROOT_ENTRY_LIMIT: usize = 894; +const ROOT_ENTRY_LIMIT: usize = 895; fn check_entries(tests_path: &Path, bad: &mut bool) { let mut directories: HashMap = HashMap::new(); diff --git a/tests/run-make/valid-print-requests/valid-print-requests.stderr b/tests/run-make/valid-print-requests/valid-print-requests.stderr index bea6ce067f6e..4f57550c29a7 100644 --- a/tests/run-make/valid-print-requests/valid-print-requests.stderr +++ b/tests/run-make/valid-print-requests/valid-print-requests.stderr @@ -1,2 +1,2 @@ -error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `all-target-specs-json`, `link-args`, `split-debuginfo` +error: unknown print request `uwu`. Valid print requests are: `crate-name`, `file-names`, `sysroot`, `target-libdir`, `cfg`, `calling-conventions`, `target-list`, `target-cpus`, `target-features`, `relocation-models`, `code-models`, `tls-models`, `native-static-libs`, `stack-protector-strategies`, `target-spec-json`, `all-target-specs-json`, `link-args`, `split-debuginfo`, `deployment-target` diff --git a/tests/ui/deployment-target/invalid-target.rs b/tests/ui/deployment-target/invalid-target.rs new file mode 100644 index 000000000000..336624320a32 --- /dev/null +++ b/tests/ui/deployment-target/invalid-target.rs @@ -0,0 +1,4 @@ +// compile-flags: --target x86_64-unknown-linux-gnu --print deployment-target +// needs-llvm-components: x86 + +fn main() {} diff --git a/tests/ui/deployment-target/invalid-target.stderr b/tests/ui/deployment-target/invalid-target.stderr new file mode 100644 index 000000000000..eb4ac131c40c --- /dev/null +++ b/tests/ui/deployment-target/invalid-target.stderr @@ -0,0 +1,2 @@ +error: only Apple targets currently support deployment version info + diff --git a/tests/ui/deployment-target/macos-target.rs b/tests/ui/deployment-target/macos-target.rs new file mode 100644 index 000000000000..701ccf4799a4 --- /dev/null +++ b/tests/ui/deployment-target/macos-target.rs @@ -0,0 +1,7 @@ +// only-macos +// compile-flags: --print deployment-target +// normalize-stdout-test: "\d+\." -> "$$CURRENT_MAJOR_VERSION." +// normalize-stdout-test: "\d+" -> "$$CURRENT_MINOR_VERSION" +// check-pass + +fn main() {} diff --git a/tests/ui/deployment-target/macos-target.stdout b/tests/ui/deployment-target/macos-target.stdout new file mode 100644 index 000000000000..f55ef568ed67 --- /dev/null +++ b/tests/ui/deployment-target/macos-target.stdout @@ -0,0 +1 @@ +deployment_target=$CURRENT_MAJOR_VERSION.$CURRENT_MINOR_VERSION From 23e443a5faab17059be8b9035bfa6f608cff1530 Mon Sep 17 00:00:00 2001 From: Wang Qilin Date: Fri, 5 May 2023 17:18:42 +0800 Subject: [PATCH 15/97] support enable rpath in each target independently --- config.example.toml | 4 ++++ src/bootstrap/builder.rs | 2 +- src/bootstrap/config.rs | 7 +++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/config.example.toml b/config.example.toml index 6d9c762ceca1..d0eaa9fd7ffa 100644 --- a/config.example.toml +++ b/config.example.toml @@ -750,6 +750,10 @@ changelog-seen = 2 # This option will override the same option under [build] section. #profiler = build.profiler (bool) +# This option supports enable `rpath` in each target independently, +# and will override the same option under [rust] section. It only works on Unix platforms +#rpath = rust.rpath (bool) + # Force static or dynamic linkage of the standard library for this target. If # this target is a host for rustc, this will also affect the linkage of the # compiler itself. This is useful for building rustc on targets that normally diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 0d2d512b4b2a..b8e50342f92c 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -1610,7 +1610,7 @@ impl<'a> Builder<'a> { // argument manually via `-C link-args=-Wl,-rpath,...`. Plus isn't it // fun to pass a flag to a tool to pass a flag to pass a flag to a tool // to change a flag in a binary? - if self.config.rust_rpath && util::use_host_linker(target) { + if self.config.rpath_enabled(target) && util::use_host_linker(target) { let rpath = if target.contains("apple") { // Note that we need to take one extra step on macOS to also pass // `-Wl,-instal_name,@rpath/...` to get things to work right. To diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index ca6dcaf49574..7a1d3e6dc488 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -455,6 +455,7 @@ pub struct Target { pub ndk: Option, pub sanitizers: Option, pub profiler: Option, + pub rpath: Option, pub crt_static: Option, pub musl_root: Option, pub musl_libdir: Option, @@ -800,6 +801,7 @@ define_config! { android_ndk: Option = "android-ndk", sanitizers: Option = "sanitizers", profiler: Option = "profiler", + rpath: Option = "rpath", crt_static: Option = "crt-static", musl_root: Option = "musl-root", musl_libdir: Option = "musl-libdir", @@ -1301,6 +1303,7 @@ impl Config { target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from); target.sanitizers = cfg.sanitizers; target.profiler = cfg.profiler; + target.rpath = cfg.rpath; config.target_config.insert(TargetSelection::from_user(&triple), target); } @@ -1610,6 +1613,10 @@ impl Config { self.target_config.values().any(|t| t.profiler == Some(true)) || self.profiler } + pub fn rpath_enabled(&self, target: TargetSelection) -> bool { + self.target_config.get(&target).map(|t| t.rpath).flatten().unwrap_or(self.rust_rpath) + } + pub fn llvm_enabled(&self) -> bool { self.rust_codegen_backends.contains(&INTERNER.intern_str("llvm")) } From fd8aa5ec7d26c8e08d13b38213391c757045e51d Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Wed, 19 Apr 2023 18:22:03 +1200 Subject: [PATCH 16/97] tweak "make mut" spans when assigning to locals --- .../src/diagnostics/mutability_errors.rs | 56 ++++++++++--------- tests/ui/array-slice-vec/slice-mut-2.stderr | 2 +- ...row-raw-address-of-deref-mutability.stderr | 4 +- .../borrowck-access-permissions.stderr | 6 +- tests/ui/borrowck/borrowck-issue-14498.stderr | 2 +- tests/ui/borrowck/issue-85765.stderr | 2 +- .../diagnostics/mut_ref.stderr | 2 +- tests/ui/did_you_mean/issue-40823.stderr | 2 +- tests/ui/error-codes/E0389.stderr | 2 +- tests/ui/issues/issue-51515.rs | 1 - tests/ui/issues/issue-51515.stderr | 6 +- tests/ui/nll/issue-47388.stderr | 2 +- 12 files changed, 46 insertions(+), 41 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 7558247948fe..b861a4f28617 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -1202,36 +1202,42 @@ fn suggest_ampmut<'tcx>( opt_assignment_rhs_span: Option, opt_ty_info: Option, ) -> (bool, Span, String) { + // if there is a RHS and it starts with a `&` from it, then check if it is + // mutable, and if not, put suggest putting `mut ` to make it mutable. + // we don't have to worry about lifetime annotations here because they are + // not valid when taking a reference. For example, the following is not valid Rust: + // + // let x: &i32 = &'a 5; + // ^^ lifetime annotation not allowed + // if let Some(assignment_rhs_span) = opt_assignment_rhs_span && let Ok(src) = tcx.sess.source_map().span_to_snippet(assignment_rhs_span) + && let Some(stripped) = src.strip_prefix('&') { - let is_mutbl = |ty: &str| -> bool { - if let Some(rest) = ty.strip_prefix("mut") { - match rest.chars().next() { - // e.g. `&mut x` - Some(c) if c.is_whitespace() => true, - // e.g. `&mut(x)` - Some('(') => true, - // e.g. `&mut{x}` - Some('{') => true, - // e.g. `&mutablevar` - _ => false, - } - } else { - false + let is_mut = if let Some(rest) = stripped.trim_start().strip_prefix("mut") { + match rest.chars().next() { + // e.g. `&mut x` + Some(c) if c.is_whitespace() => true, + // e.g. `&mut(x)` + Some('(') => true, + // e.g. `&mut{x}` + Some('{') => true, + // e.g. `&mutablevar` + _ => false, } + } else { + false }; - if let (true, Some(ws_pos)) = (src.starts_with("&'"), src.find(char::is_whitespace)) { - let lt_name = &src[1..ws_pos]; - let ty = src[ws_pos..].trim_start(); - if !is_mutbl(ty) { - return (true, assignment_rhs_span, format!("&{lt_name} mut {ty}")); - } - } else if let Some(stripped) = src.strip_prefix('&') { - let stripped = stripped.trim_start(); - if !is_mutbl(stripped) { - return (true, assignment_rhs_span, format!("&mut {stripped}")); - } + // if the reference is already mutable then there is nothing we can do + // here. + if !is_mut { + let span = assignment_rhs_span; + // shrink the span to just after the `&` in `&variable` + let span = span.with_lo(span.lo() + BytePos(1)).shrink_to_lo(); + + // FIXME(Ezrashaw): returning is bad because we still might want to + // update the annotated type, see #106857. + return (true, span, "mut ".to_owned()); } } diff --git a/tests/ui/array-slice-vec/slice-mut-2.stderr b/tests/ui/array-slice-vec/slice-mut-2.stderr index 5b040d3e4d31..c33919c41cdc 100644 --- a/tests/ui/array-slice-vec/slice-mut-2.stderr +++ b/tests/ui/array-slice-vec/slice-mut-2.stderr @@ -7,7 +7,7 @@ LL | let _ = &mut x[2..4]; help: consider changing this to be a mutable reference | LL | let x: &[isize] = &mut [1, 2, 3, 4, 5]; - | ~~~~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to previous error diff --git a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr index 4cc1d821d0a0..cfc86ff0dc12 100644 --- a/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr +++ b/tests/ui/borrowck/borrow-raw-address-of-deref-mutability.stderr @@ -7,7 +7,7 @@ LL | let q = &raw mut *x; help: consider changing this to be a mutable reference | LL | let x = &mut 0; - | ~~~~~~ + | +++ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer --> $DIR/borrow-raw-address-of-deref-mutability.rs:14:13 @@ -18,7 +18,7 @@ LL | let q = &raw mut *x; help: consider changing this to be a mutable pointer | LL | let x = &mut 0 as *const i32; - | ~~~~~~ + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-access-permissions.stderr b/tests/ui/borrowck/borrowck-access-permissions.stderr index 26f3e2bbdb77..c161e2d95b43 100644 --- a/tests/ui/borrowck/borrowck-access-permissions.stderr +++ b/tests/ui/borrowck/borrowck-access-permissions.stderr @@ -35,7 +35,7 @@ LL | let _y1 = &mut *ref_x; help: consider changing this to be a mutable reference | LL | let ref_x = &mut x; - | ~~~~~~ + | +++ error[E0596]: cannot borrow `*ptr_x` as mutable, as it is behind a `*const` pointer --> $DIR/borrowck-access-permissions.rs:39:23 @@ -46,7 +46,7 @@ LL | let _y1 = &mut *ptr_x; help: consider changing this to be a mutable pointer | LL | let ptr_x : *const _ = &mut x; - | ~~~~~~ + | +++ error[E0596]: cannot borrow `*foo_ref.f` as mutable, as it is behind a `&` reference --> $DIR/borrowck-access-permissions.rs:48:18 @@ -57,7 +57,7 @@ LL | let _y = &mut *foo_ref.f; help: consider changing this to be a mutable reference | LL | let foo_ref = &mut foo; - | ~~~~~~~~ + | +++ error: aborting due to 6 previous errors diff --git a/tests/ui/borrowck/borrowck-issue-14498.stderr b/tests/ui/borrowck/borrowck-issue-14498.stderr index 374c5ee3ed27..12d67d536d95 100644 --- a/tests/ui/borrowck/borrowck-issue-14498.stderr +++ b/tests/ui/borrowck/borrowck-issue-14498.stderr @@ -7,7 +7,7 @@ LL | ***p = 2; help: consider changing this to be a mutable reference | LL | let p = &mut y; - | ~~~~~~ + | +++ error[E0506]: cannot assign to `**y` because it is borrowed --> $DIR/borrowck-issue-14498.rs:25:5 diff --git a/tests/ui/borrowck/issue-85765.stderr b/tests/ui/borrowck/issue-85765.stderr index b4bb128cbb42..2985a658fddb 100644 --- a/tests/ui/borrowck/issue-85765.stderr +++ b/tests/ui/borrowck/issue-85765.stderr @@ -18,7 +18,7 @@ LL | *r = 0; help: consider changing this to be a mutable reference | LL | let r = &mut mutvar; - | ~~~~~~~~~~~ + | +++ error[E0594]: cannot assign to `*x`, which is behind a `&` reference --> $DIR/issue-85765.rs:19:5 diff --git a/tests/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr b/tests/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr index 95f36fc042c4..1904faa95986 100644 --- a/tests/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr +++ b/tests/ui/closures/2229_closure_analysis/diagnostics/mut_ref.stderr @@ -10,7 +10,7 @@ LL | **ref_mref_x = y; help: consider changing this to be a mutable reference | LL | let ref_mref_x = &mut mref_x; - | ~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `**mref_ref_x` as mutable, as it is behind a `&` reference --> $DIR/mut_ref.rs:26:13 diff --git a/tests/ui/did_you_mean/issue-40823.stderr b/tests/ui/did_you_mean/issue-40823.stderr index aadd698891ed..ba94a5702563 100644 --- a/tests/ui/did_you_mean/issue-40823.stderr +++ b/tests/ui/did_you_mean/issue-40823.stderr @@ -7,7 +7,7 @@ LL | buf.iter_mut(); help: consider changing this to be a mutable reference | LL | let mut buf = &mut [1, 2, 3, 4]; - | ~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to previous error diff --git a/tests/ui/error-codes/E0389.stderr b/tests/ui/error-codes/E0389.stderr index 51c4c92addf2..e4001856c388 100644 --- a/tests/ui/error-codes/E0389.stderr +++ b/tests/ui/error-codes/E0389.stderr @@ -7,7 +7,7 @@ LL | fancy_ref.num = 6; help: consider changing this to be a mutable reference | LL | let fancy_ref = &mut (&mut fancy); - | ~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to previous error diff --git a/tests/ui/issues/issue-51515.rs b/tests/ui/issues/issue-51515.rs index 84e09afac0a2..33a9bf85e23e 100644 --- a/tests/ui/issues/issue-51515.rs +++ b/tests/ui/issues/issue-51515.rs @@ -1,7 +1,6 @@ fn main() { let foo = &16; //~^ HELP consider changing this to be a mutable reference - //~| SUGGESTION &mut 16 *foo = 32; //~^ ERROR cannot assign to `*foo`, which is behind a `&` reference let bar = foo; diff --git a/tests/ui/issues/issue-51515.stderr b/tests/ui/issues/issue-51515.stderr index 94e5c9f1b832..88b8d2109088 100644 --- a/tests/ui/issues/issue-51515.stderr +++ b/tests/ui/issues/issue-51515.stderr @@ -1,5 +1,5 @@ error[E0594]: cannot assign to `*foo`, which is behind a `&` reference - --> $DIR/issue-51515.rs:5:5 + --> $DIR/issue-51515.rs:4:5 | LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written @@ -7,10 +7,10 @@ LL | *foo = 32; help: consider changing this to be a mutable reference | LL | let foo = &mut 16; - | ~~~~~~~ + | +++ error[E0594]: cannot assign to `*bar`, which is behind a `&` reference - --> $DIR/issue-51515.rs:9:5 + --> $DIR/issue-51515.rs:8:5 | LL | *bar = 64; | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written diff --git a/tests/ui/nll/issue-47388.stderr b/tests/ui/nll/issue-47388.stderr index c780451dfa93..09b9d638afb0 100644 --- a/tests/ui/nll/issue-47388.stderr +++ b/tests/ui/nll/issue-47388.stderr @@ -7,7 +7,7 @@ LL | fancy_ref.num = 6; help: consider changing this to be a mutable reference | LL | let fancy_ref = &mut (&mut fancy); - | ~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to previous error From 9624d2b08e87995978899f236db1857e85097b37 Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Wed, 19 Apr 2023 19:29:28 +1200 Subject: [PATCH 17/97] tweak "make mut" spans (No. 2) --- .../src/diagnostics/mutability_errors.rs | 48 +++++++++++-------- tests/ui/did_you_mean/issue-39544.stderr | 2 +- tests/ui/issues/issue-61623.stderr | 2 +- ...ck-borrow-overloaded-auto-deref-mut.stderr | 4 +- ...orrowck-borrow-overloaded-deref-mut.stderr | 4 +- tests/ui/span/mut-arg-hint.stderr | 2 +- ...l-bounds-inconsistent-copy-reborrow.stderr | 4 +- 7 files changed, 36 insertions(+), 30 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index b861a4f28617..27f700ebbdaf 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -1241,35 +1241,41 @@ fn suggest_ampmut<'tcx>( } } - let (suggestibility, highlight_span) = match opt_ty_info { + let (binding_exists, span) = match opt_ty_info { // if this is a variable binding with an explicit type, - // try to highlight that for the suggestion. + // then we will suggest changing it to be mutable. + // this is `Applicability::MachineApplicable`. Some(ty_span) => (true, ty_span), - // otherwise, just highlight the span associated with - // the (MIR) LocalDecl. + // otherwise, we'll suggest *adding* an annotated type, we'll suggest + // the RHS's type for that. + // this is `Applicability::HasPlaceholders`. None => (false, local_decl.source_info.span), }; - if let Ok(src) = tcx.sess.source_map().span_to_snippet(highlight_span) - && let (true, Some(ws_pos)) = (src.starts_with("&'"), src.find(char::is_whitespace)) + // if the binding already exists and is a reference with a explicit + // lifetime, then we can suggest adding ` mut`. this is special-cased from + // the path without a explicit lifetime. + if let Ok(src) = tcx.sess.source_map().span_to_snippet(span) + && src.starts_with("&'") + // note that `& 'a T` is invalid so this is correct. + && let Some(ws_pos) = src.find(char::is_whitespace) { - let lt_name = &src[1..ws_pos]; - let ty = &src[ws_pos..]; - return (true, highlight_span, format!("&{lt_name} mut{ty}")); + let span = span.with_lo(span.lo() + BytePos(ws_pos as u32)).shrink_to_lo(); + (true, span, " mut".to_owned()) + } else { + let ty_mut = local_decl.ty.builtin_deref(true).unwrap(); + assert_eq!(ty_mut.mutbl, hir::Mutability::Not); + ( + binding_exists, + span, + if local_decl.ty.is_ref() { + format!("&mut {}", ty_mut.ty) + } else { + format!("*mut {}", ty_mut.ty) + }, + ) } - - let ty_mut = local_decl.ty.builtin_deref(true).unwrap(); - assert_eq!(ty_mut.mutbl, hir::Mutability::Not); - ( - suggestibility, - highlight_span, - if local_decl.ty.is_ref() { - format!("&mut {}", ty_mut.ty) - } else { - format!("*mut {}", ty_mut.ty) - }, - ) } fn is_closure_or_generator(ty: Ty<'_>) -> bool { diff --git a/tests/ui/did_you_mean/issue-39544.stderr b/tests/ui/did_you_mean/issue-39544.stderr index 8dc0512a9453..97f0ec60603c 100644 --- a/tests/ui/did_you_mean/issue-39544.stderr +++ b/tests/ui/did_you_mean/issue-39544.stderr @@ -73,7 +73,7 @@ LL | let _ = &mut self.x; help: consider changing this to be a mutable reference | LL | fn foo3<'a>(self: &'a mut Self, other: &Z) { - | ~~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference --> $DIR/issue-39544.rs:31:17 diff --git a/tests/ui/issues/issue-61623.stderr b/tests/ui/issues/issue-61623.stderr index 5fcc338557c5..bedea3890a32 100644 --- a/tests/ui/issues/issue-61623.stderr +++ b/tests/ui/issues/issue-61623.stderr @@ -7,7 +7,7 @@ LL | f2(|| x.0, f1(x.1)) help: consider changing this to be a mutable reference | LL | fn f3<'a>(x: &'a mut ((), &'a mut ())) { - | ~~~~~~~~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to previous error diff --git a/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr index 570328fc211f..e640d40913e3 100644 --- a/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr +++ b/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr @@ -50,7 +50,7 @@ LL | x.y = 3; help: consider changing this to be a mutable reference | LL | fn assign_field2<'a>(x: &'a mut Own) { - | ~~~~~~~~~~~~~~~~~~ + | +++ error[E0499]: cannot borrow `*x` as mutable more than once at a time --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:101:5 @@ -104,7 +104,7 @@ LL | *x.y_mut() = 3; help: consider changing this to be a mutable reference | LL | fn assign_method2<'a>(x: &'a mut Own) { - | ~~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to 10 previous errors diff --git a/tests/ui/span/borrowck-borrow-overloaded-deref-mut.stderr b/tests/ui/span/borrowck-borrow-overloaded-deref-mut.stderr index 3fed7b3f4dcf..dbd52dc2d38d 100644 --- a/tests/ui/span/borrowck-borrow-overloaded-deref-mut.stderr +++ b/tests/ui/span/borrowck-borrow-overloaded-deref-mut.stderr @@ -18,7 +18,7 @@ LL | &mut **x help: consider changing this to be a mutable reference | LL | fn deref_extend_mut1<'a>(x: &'a mut Own) -> &'a mut isize { - | ~~~~~~~~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/borrowck-borrow-overloaded-deref-mut.rs:49:6 @@ -40,7 +40,7 @@ LL | **x = 3; help: consider changing this to be a mutable reference | LL | fn assign2<'a>(x: &'a mut Own) { - | ~~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to 4 previous errors diff --git a/tests/ui/span/mut-arg-hint.stderr b/tests/ui/span/mut-arg-hint.stderr index 96ce4d5bc6c3..9b82012291cf 100644 --- a/tests/ui/span/mut-arg-hint.stderr +++ b/tests/ui/span/mut-arg-hint.stderr @@ -18,7 +18,7 @@ LL | a.push_str("foo"); help: consider changing this to be a mutable reference | LL | pub fn foo<'a>(mut a: &'a mut String) { - | ~~~~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/mut-arg-hint.rs:15:9 diff --git a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr index 39b60c311972..c054ddb893d5 100644 --- a/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr +++ b/tests/ui/trivial-bounds/trivial-bounds-inconsistent-copy-reborrow.stderr @@ -7,7 +7,7 @@ LL | *t help: consider changing this to be a mutable reference | LL | fn reborrow_mut<'a>(t: &'a mut &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { - | ~~~~~~~~~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `**t` as mutable, as it is behind a `&` reference --> $DIR/trivial-bounds-inconsistent-copy-reborrow.rs:10:6 @@ -18,7 +18,7 @@ LL | {*t} help: consider changing this to be a mutable reference | LL | fn copy_reborrow_mut<'a>(t: &'a mut &'a mut i32) -> &'a mut i32 where &'a mut i32: Copy { - | ~~~~~~~~~~~~~~~~~~~ + | +++ error: aborting due to 2 previous errors From 57c6a3183c17e9f889adda1faca894a7cd692b02 Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Wed, 19 Apr 2023 19:50:08 +1200 Subject: [PATCH 18/97] tweak "make mut" spans (No. 3) --- .../src/diagnostics/mutability_errors.rs | 4 ++++ ...k-assign-to-andmut-in-aliasable-loc.stderr | 8 +++---- ...orrow-mut-base-ptr-in-aliasable-loc.stderr | 4 ++-- .../borrowck-reborrow-from-mut.stderr | 2 +- tests/ui/borrowck/mutability-errors.stderr | 24 +++++++++---------- tests/ui/did_you_mean/issue-38147-4.stderr | 4 ++-- tests/ui/did_you_mean/issue-39544.stderr | 10 ++++---- tests/ui/nll/issue-57989.stderr | 2 +- ...ck-borrow-overloaded-auto-deref-mut.stderr | 4 ++-- ...borrowck-call-is-borrow-issue-12224.stderr | 6 ++--- ...owck-call-method-from-mut-aliasable.stderr | 2 +- tests/ui/span/borrowck-fn-in-const-b.stderr | 2 +- .../ui/span/borrowck-object-mutability.stderr | 2 +- tests/ui/span/mut-arg-hint.stderr | 4 ++-- tests/ui/suggestions/issue-68049-2.stderr | 4 ++-- 15 files changed, 43 insertions(+), 39 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 27f700ebbdaf..50f9e7095f93 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -1263,6 +1263,10 @@ fn suggest_ampmut<'tcx>( { let span = span.with_lo(span.lo() + BytePos(ws_pos as u32)).shrink_to_lo(); (true, span, " mut".to_owned()) + } else if binding_exists { + // shrink the span to just after the `&` in `&variable` + let span = span.with_lo(span.lo() + BytePos(1)).shrink_to_lo(); + (true, span, "mut ".to_owned()) } else { let ty_mut = local_decl.ty.builtin_deref(true).unwrap(); assert_eq!(ty_mut.mutbl, hir::Mutability::Not); diff --git a/tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr b/tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr index cbacc87a0e85..cf0c4127d82f 100644 --- a/tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr +++ b/tests/ui/borrowck/borrowck-assign-to-andmut-in-aliasable-loc.stderr @@ -6,8 +6,8 @@ LL | *s.pointer += 1; | help: consider changing this to be a mutable reference | -LL | fn a(s: &mut S<'_>) { - | ~~~~~~~~~~ +LL | fn a(s: &mut S) { + | +++ error[E0594]: cannot assign to `*s.pointer`, which is behind a `&` reference --> $DIR/borrowck-assign-to-andmut-in-aliasable-loc.rs:17:5 @@ -17,8 +17,8 @@ LL | *s.pointer += 1; | help: consider changing this to be a mutable reference | -LL | fn c(s: &mut &mut S<'_>) { - | ~~~~~~~~~~~~~~~ +LL | fn c(s: &mut &mut S) { + | +++ error: aborting due to 2 previous errors diff --git a/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr b/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr index dd0817ff2331..59ef61b19d50 100644 --- a/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr +++ b/tests/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr @@ -27,8 +27,8 @@ LL | let x: &mut isize = &mut **t0; | help: consider changing this to be a mutable reference | -LL | fn foo4(t0: &mut &mut isize) { - | ~~~~~~~~~~~~~~~ +LL | fn foo4(t0: &mut &mut isize) { + | +++ error: aborting due to 3 previous errors diff --git a/tests/ui/borrowck/borrowck-reborrow-from-mut.stderr b/tests/ui/borrowck/borrowck-reborrow-from-mut.stderr index d9590e446c75..fb3db4e14463 100644 --- a/tests/ui/borrowck/borrowck-reborrow-from-mut.stderr +++ b/tests/ui/borrowck/borrowck-reborrow-from-mut.stderr @@ -111,7 +111,7 @@ LL | let _bar1 = &mut foo.bar1; help: consider changing this to be a mutable reference | LL | fn borrow_mut_from_imm(foo: &mut Foo) { - | ~~~~~~~~ + | +++ error: aborting due to 11 previous errors diff --git a/tests/ui/borrowck/mutability-errors.stderr b/tests/ui/borrowck/mutability-errors.stderr index d7c602718f17..b39e57d70ec6 100644 --- a/tests/ui/borrowck/mutability-errors.stderr +++ b/tests/ui/borrowck/mutability-errors.stderr @@ -7,7 +7,7 @@ LL | *x = (1,); help: consider changing this to be a mutable reference | LL | fn named_ref(x: &mut (i32,)) { - | ~~~~~~~~~~~ + | +++ error[E0594]: cannot assign to `x.0`, which is behind a `&` reference --> $DIR/mutability-errors.rs:10:5 @@ -18,7 +18,7 @@ LL | x.0 = 1; help: consider changing this to be a mutable reference | LL | fn named_ref(x: &mut (i32,)) { - | ~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `&` reference --> $DIR/mutability-errors.rs:11:5 @@ -29,7 +29,7 @@ LL | &mut *x; help: consider changing this to be a mutable reference | LL | fn named_ref(x: &mut (i32,)) { - | ~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `&` reference --> $DIR/mutability-errors.rs:12:5 @@ -40,7 +40,7 @@ LL | &mut x.0; help: consider changing this to be a mutable reference | LL | fn named_ref(x: &mut (i32,)) { - | ~~~~~~~~~~~ + | +++ error[E0594]: cannot assign to data in a `&` reference --> $DIR/mutability-errors.rs:16:5 @@ -74,8 +74,8 @@ LL | *x = (1,); | help: consider changing this to be a mutable pointer | -LL | unsafe fn named_ptr(x: *mut (i32,)) { - | ~~~~~~~~~~~ +LL | unsafe fn named_ptr(x: *mut const (i32,)) { + | +++ error[E0594]: cannot assign to `x.0`, which is behind a `*const` pointer --> $DIR/mutability-errors.rs:24:5 @@ -85,8 +85,8 @@ LL | (*x).0 = 1; | help: consider changing this to be a mutable pointer | -LL | unsafe fn named_ptr(x: *mut (i32,)) { - | ~~~~~~~~~~~ +LL | unsafe fn named_ptr(x: *mut const (i32,)) { + | +++ error[E0596]: cannot borrow `*x` as mutable, as it is behind a `*const` pointer --> $DIR/mutability-errors.rs:25:5 @@ -96,8 +96,8 @@ LL | &mut *x; | help: consider changing this to be a mutable pointer | -LL | unsafe fn named_ptr(x: *mut (i32,)) { - | ~~~~~~~~~~~ +LL | unsafe fn named_ptr(x: *mut const (i32,)) { + | +++ error[E0596]: cannot borrow `x.0` as mutable, as it is behind a `*const` pointer --> $DIR/mutability-errors.rs:26:5 @@ -107,8 +107,8 @@ LL | &mut (*x).0; | help: consider changing this to be a mutable pointer | -LL | unsafe fn named_ptr(x: *mut (i32,)) { - | ~~~~~~~~~~~ +LL | unsafe fn named_ptr(x: *mut const (i32,)) { + | +++ error[E0594]: cannot assign to data in a `*const` pointer --> $DIR/mutability-errors.rs:30:5 diff --git a/tests/ui/did_you_mean/issue-38147-4.stderr b/tests/ui/did_you_mean/issue-38147-4.stderr index d33399893616..43647fa562b9 100644 --- a/tests/ui/did_you_mean/issue-38147-4.stderr +++ b/tests/ui/did_you_mean/issue-38147-4.stderr @@ -6,8 +6,8 @@ LL | f.s.push('x'); | help: consider changing this to be a mutable reference | -LL | fn f(x: usize, f: &mut Foo<'_>) { - | ~~~~~~~~~~~~ +LL | fn f(x: usize, f: &mut Foo) { + | +++ error: aborting due to previous error diff --git a/tests/ui/did_you_mean/issue-39544.stderr b/tests/ui/did_you_mean/issue-39544.stderr index 97f0ec60603c..8ccb4cbb0c16 100644 --- a/tests/ui/did_you_mean/issue-39544.stderr +++ b/tests/ui/did_you_mean/issue-39544.stderr @@ -40,7 +40,7 @@ LL | let _ = &mut other.x; help: consider changing this to be a mutable reference | LL | fn foo1(&self, other: &mut Z) { - | ~~~~~~ + | +++ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference --> $DIR/issue-39544.rs:25:17 @@ -62,7 +62,7 @@ LL | let _ = &mut other.x; help: consider changing this to be a mutable reference | LL | fn foo2<'a>(&'a self, other: &mut Z) { - | ~~~~~~ + | +++ error[E0596]: cannot borrow `self.x` as mutable, as it is behind a `&` reference --> $DIR/issue-39544.rs:30:17 @@ -84,7 +84,7 @@ LL | let _ = &mut other.x; help: consider changing this to be a mutable reference | LL | fn foo3<'a>(self: &'a Self, other: &mut Z) { - | ~~~~~~ + | +++ error[E0596]: cannot borrow `other.x` as mutable, as it is behind a `&` reference --> $DIR/issue-39544.rs:35:17 @@ -95,7 +95,7 @@ LL | let _ = &mut other.x; help: consider changing this to be a mutable reference | LL | fn foo4(other: &mut Z) { - | ~~~~~~ + | +++ error[E0596]: cannot borrow `z.x` as mutable, as `z` is not declared as mutable --> $DIR/issue-39544.rs:41:13 @@ -117,7 +117,7 @@ LL | let _ = &mut w.x; help: consider changing this to be a mutable reference | LL | pub fn with_arg(z: Z, w: &mut Z) { - | ~~~~~~ + | +++ error[E0594]: cannot assign to `*x.0`, which is behind a `&` reference --> $DIR/issue-39544.rs:48:5 diff --git a/tests/ui/nll/issue-57989.stderr b/tests/ui/nll/issue-57989.stderr index d5effd6f346d..6062b31d6883 100644 --- a/tests/ui/nll/issue-57989.stderr +++ b/tests/ui/nll/issue-57989.stderr @@ -7,7 +7,7 @@ LL | *x = 0; help: consider changing this to be a mutable reference | LL | fn f(x: &mut i32) { - | ~~~~~~~~ + | +++ error[E0506]: cannot assign to `*x` because it is borrowed --> $DIR/issue-57989.rs:5:5 diff --git a/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr b/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr index e640d40913e3..80c5f9da40ce 100644 --- a/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr +++ b/tests/ui/span/borrowck-borrow-overloaded-auto-deref-mut.stderr @@ -18,7 +18,7 @@ LL | &mut x.y help: consider changing this to be a mutable reference | LL | fn deref_extend_mut_field1(x: &mut Own) -> &mut isize { - | ~~~~~~~~~~~~~~~ + | +++ error[E0499]: cannot borrow `*x` as mutable more than once at a time --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:78:19 @@ -82,7 +82,7 @@ LL | x.y_mut() help: consider changing this to be a mutable reference | LL | fn deref_extend_mut_method1(x: &mut Own) -> &mut isize { - | ~~~~~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `x` as mutable, as it is not declared as mutable --> $DIR/borrowck-borrow-overloaded-auto-deref-mut.rs:129:6 diff --git a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr index 9711dad80785..99c8fa1f932d 100644 --- a/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr +++ b/tests/ui/span/borrowck-call-is-borrow-issue-12224.stderr @@ -19,7 +19,7 @@ LL | (*f)(); help: consider changing this to be a mutable reference | LL | fn test2(f: &mut F) where F: FnMut() { - | ~~~~~~ + | +++ error[E0596]: cannot borrow `f.f` as mutable, as it is behind a `&` reference --> $DIR/borrowck-call-is-borrow-issue-12224.rs:34:5 @@ -29,8 +29,8 @@ LL | f.f.call_mut(()) | help: consider changing this to be a mutable reference | -LL | fn test4(f: &mut Test<'_>) { - | ~~~~~~~~~~~~~ +LL | fn test4(f: &mut Test) { + | +++ error[E0507]: cannot move out of `f`, a captured variable in an `FnMut` closure --> $DIR/borrowck-call-is-borrow-issue-12224.rs:57:13 diff --git a/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr b/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr index 2a842f5a2a9f..328197ae9f42 100644 --- a/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr +++ b/tests/ui/span/borrowck-call-method-from-mut-aliasable.stderr @@ -7,7 +7,7 @@ LL | x.h(); help: consider changing this to be a mutable reference | LL | fn b(x: &mut Foo) { - | ~~~~~~~~ + | +++ error: aborting due to previous error diff --git a/tests/ui/span/borrowck-fn-in-const-b.stderr b/tests/ui/span/borrowck-fn-in-const-b.stderr index 1df19deb12f6..17fdcc622f77 100644 --- a/tests/ui/span/borrowck-fn-in-const-b.stderr +++ b/tests/ui/span/borrowck-fn-in-const-b.stderr @@ -7,7 +7,7 @@ LL | x.push(format!("this is broken")); help: consider changing this to be a mutable reference | LL | fn broken(x: &mut Vec) { - | ~~~~~~~~~~~~~~~~ + | +++ error: aborting due to previous error diff --git a/tests/ui/span/borrowck-object-mutability.stderr b/tests/ui/span/borrowck-object-mutability.stderr index b6517e0b3095..805a8034c184 100644 --- a/tests/ui/span/borrowck-object-mutability.stderr +++ b/tests/ui/span/borrowck-object-mutability.stderr @@ -7,7 +7,7 @@ LL | x.borrowed_mut(); help: consider changing this to be a mutable reference | LL | fn borrowed_receiver(x: &mut dyn Foo) { - | ~~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `*x` as mutable, as `x` is not declared as mutable --> $DIR/borrowck-object-mutability.rs:18:5 diff --git a/tests/ui/span/mut-arg-hint.stderr b/tests/ui/span/mut-arg-hint.stderr index 9b82012291cf..06011eac674c 100644 --- a/tests/ui/span/mut-arg-hint.stderr +++ b/tests/ui/span/mut-arg-hint.stderr @@ -7,7 +7,7 @@ LL | a.push_str("bar"); help: consider changing this to be a mutable reference | LL | fn foo(mut a: &mut String) { - | ~~~~~~~~~~~ + | +++ error[E0596]: cannot borrow `*a` as mutable, as it is behind a `&` reference --> $DIR/mut-arg-hint.rs:8:5 @@ -29,7 +29,7 @@ LL | a.push_str("foo"); help: consider changing this to be a mutable reference | LL | pub fn foo(mut a: &mut String) { - | ~~~~~~~~~~~ + | +++ error: aborting due to 3 previous errors diff --git a/tests/ui/suggestions/issue-68049-2.stderr b/tests/ui/suggestions/issue-68049-2.stderr index de35aa5b186b..833799081598 100644 --- a/tests/ui/suggestions/issue-68049-2.stderr +++ b/tests/ui/suggestions/issue-68049-2.stderr @@ -6,8 +6,8 @@ LL | *input = self.0; | help: consider changing that to be a mutable reference | -LL | fn example(&self, input: &mut i32); // should suggest here - | ~~~~~~~~ +LL | fn example(&self, input: mut ); // should suggest here + | ~~~ error[E0594]: cannot assign to `self.0`, which is behind a `&` reference --> $DIR/issue-68049-2.rs:17:5 From 336a6569f5477d36151500bbd7c57e3bba357cec Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Wed, 19 Apr 2023 20:00:49 +1200 Subject: [PATCH 19/97] tweak "make mut" spans (No. 4) --- .../src/diagnostics/mutability_errors.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 50f9e7095f93..e842afced819 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -1263,21 +1263,21 @@ fn suggest_ampmut<'tcx>( { let span = span.with_lo(span.lo() + BytePos(ws_pos as u32)).shrink_to_lo(); (true, span, " mut".to_owned()) + // if there is already a binding, we modify it to be `mut` } else if binding_exists { // shrink the span to just after the `&` in `&variable` let span = span.with_lo(span.lo() + BytePos(1)).shrink_to_lo(); (true, span, "mut ".to_owned()) + // otherwise, suggest that the user annotates the binding; we provide the + // type of the local. } else { let ty_mut = local_decl.ty.builtin_deref(true).unwrap(); assert_eq!(ty_mut.mutbl, hir::Mutability::Not); + ( - binding_exists, + false, span, - if local_decl.ty.is_ref() { - format!("&mut {}", ty_mut.ty) - } else { - format!("*mut {}", ty_mut.ty) - }, + format!("{}mut {}", if local_decl.ty.is_ref() {"&"} else {"*"}, ty_mut.ty) ) } } From 87a1b3840ecfebdcd22313ed37f0609732d8cf83 Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Thu, 20 Apr 2023 18:58:43 +1200 Subject: [PATCH 20/97] tweak spans for `ref mut` suggestion --- .../src/diagnostics/mutability_errors.rs | 16 +++++++++------- tests/ui/nll/issue-51244.stderr | 2 +- .../borrowck-move-ref-pattern.stderr | 4 ++-- tests/ui/suggestions/suggest-ref-mut.rs | 3 --- tests/ui/suggestions/suggest-ref-mut.stderr | 12 ++++++------ 5 files changed, 18 insertions(+), 19 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index e842afced819..0a89eb072455 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -559,9 +559,9 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { binding_mode: ty::BindingMode::BindByReference(_), .. })) => { - let pattern_span = local_decl.source_info.span; + let pattern_span: Span = local_decl.source_info.span; suggest_ref_mut(self.infcx.tcx, pattern_span) - .map(|replacement| (true, pattern_span, replacement)) + .map(|span| (true, span, "mut ".to_owned())) } _ => unreachable!(), @@ -1316,11 +1316,13 @@ fn get_mut_span_in_struct_field<'tcx>( } /// If possible, suggest replacing `ref` with `ref mut`. -fn suggest_ref_mut(tcx: TyCtxt<'_>, binding_span: Span) -> Option { - let hi_src = tcx.sess.source_map().span_to_snippet(binding_span).ok()?; - if hi_src.starts_with("ref") && hi_src["ref".len()..].starts_with(rustc_lexer::is_whitespace) { - let replacement = format!("ref mut{}", &hi_src["ref".len()..]); - Some(replacement) +fn suggest_ref_mut(tcx: TyCtxt<'_>, span: Span) -> Option { + let pattern_str = tcx.sess.source_map().span_to_snippet(span).ok()?; + if pattern_str.starts_with("ref") + && pattern_str["ref".len()..].starts_with(rustc_lexer::is_whitespace) + { + let span = span.with_lo(span.lo() + BytePos(4)).shrink_to_lo(); + Some(span) } else { None } diff --git a/tests/ui/nll/issue-51244.stderr b/tests/ui/nll/issue-51244.stderr index 03d8acc81886..8ccb5809e397 100644 --- a/tests/ui/nll/issue-51244.stderr +++ b/tests/ui/nll/issue-51244.stderr @@ -7,7 +7,7 @@ LL | *my_ref = 0; help: consider changing this to be a mutable reference | LL | let ref mut my_ref @ _ = 0; - | ~~~~~~~~~~~~~~ + | +++ error: aborting due to previous error diff --git a/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr b/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr index c7c7c074f7cd..a033cc0655ef 100644 --- a/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr +++ b/tests/ui/pattern/move-ref-patterns/borrowck-move-ref-pattern.stderr @@ -112,7 +112,7 @@ LL | *_x0 = U; help: consider changing this to be a mutable reference | LL | let (ref mut _x0, _x1, ref _x2, ..) = tup; - | ~~~~~~~~~~~ + | +++ error[E0594]: cannot assign to `*_x2`, which is behind a `&` reference --> $DIR/borrowck-move-ref-pattern.rs:27:5 @@ -123,7 +123,7 @@ LL | *_x2 = U; help: consider changing this to be a mutable reference | LL | let (ref _x0, _x1, ref mut _x2, ..) = tup; - | ~~~~~~~~~~~ + | +++ error[E0382]: use of moved value: `tup.1` --> $DIR/borrowck-move-ref-pattern.rs:28:10 diff --git a/tests/ui/suggestions/suggest-ref-mut.rs b/tests/ui/suggestions/suggest-ref-mut.rs index d04113ffccc3..b40439b8e372 100644 --- a/tests/ui/suggestions/suggest-ref-mut.rs +++ b/tests/ui/suggestions/suggest-ref-mut.rs @@ -12,12 +12,10 @@ impl X { fn main() { let ref foo = 16; //~^ HELP - //~| SUGGESTION ref mut foo *foo = 32; //~^ ERROR if let Some(ref bar) = Some(16) { //~^ HELP - //~| SUGGESTION ref mut bar *bar = 32; //~^ ERROR } @@ -25,6 +23,5 @@ fn main() { ref quo => { *quo = 32; }, //~^ ERROR //~| HELP - //~| SUGGESTION ref mut quo } } diff --git a/tests/ui/suggestions/suggest-ref-mut.stderr b/tests/ui/suggestions/suggest-ref-mut.stderr index 7973759bf5ec..cc00022ab8e3 100644 --- a/tests/ui/suggestions/suggest-ref-mut.stderr +++ b/tests/ui/suggestions/suggest-ref-mut.stderr @@ -10,7 +10,7 @@ LL | fn zap(&mut self) { | ~~~~~~~~~ error[E0594]: cannot assign to `*foo`, which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:16:5 + --> $DIR/suggest-ref-mut.rs:15:5 | LL | *foo = 32; | ^^^^^^^^^ `foo` is a `&` reference, so the data it refers to cannot be written @@ -18,10 +18,10 @@ LL | *foo = 32; help: consider changing this to be a mutable reference | LL | let ref mut foo = 16; - | ~~~~~~~~~~~ + | +++ error[E0594]: cannot assign to `*bar`, which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:21:9 + --> $DIR/suggest-ref-mut.rs:19:9 | LL | *bar = 32; | ^^^^^^^^^ `bar` is a `&` reference, so the data it refers to cannot be written @@ -29,10 +29,10 @@ LL | *bar = 32; help: consider changing this to be a mutable reference | LL | if let Some(ref mut bar) = Some(16) { - | ~~~~~~~~~~~ + | +++ error[E0594]: cannot assign to `*quo`, which is behind a `&` reference - --> $DIR/suggest-ref-mut.rs:25:22 + --> $DIR/suggest-ref-mut.rs:23:22 | LL | ref quo => { *quo = 32; }, | ^^^^^^^^^ `quo` is a `&` reference, so the data it refers to cannot be written @@ -40,7 +40,7 @@ LL | ref quo => { *quo = 32; }, help: consider changing this to be a mutable reference | LL | ref mut quo => { *quo = 32; }, - | ~~~~~~~~~~~ + | +++ error: aborting due to 4 previous errors From d2608dfabb3a353fd2ab25f8bb1abf04b497af3b Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Fri, 21 Apr 2023 13:29:15 +1200 Subject: [PATCH 21/97] implement review comment Co-authored-by: Esteban Kuber --- compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index 0a89eb072455..a98a07a74e58 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -1268,9 +1268,9 @@ fn suggest_ampmut<'tcx>( // shrink the span to just after the `&` in `&variable` let span = span.with_lo(span.lo() + BytePos(1)).shrink_to_lo(); (true, span, "mut ".to_owned()) - // otherwise, suggest that the user annotates the binding; we provide the - // type of the local. } else { + // otherwise, suggest that the user annotates the binding; we provide the + // type of the local. let ty_mut = local_decl.ty.builtin_deref(true).unwrap(); assert_eq!(ty_mut.mutbl, hir::Mutability::Not); From 3e64e986fe1cbaa3679cd228a6900304ebf81018 Mon Sep 17 00:00:00 2001 From: Ezra Shaw Date: Fri, 21 Apr 2023 23:49:05 +1200 Subject: [PATCH 22/97] fix trait definition spans in "make mut" suggestion --- .../src/diagnostics/mutability_errors.rs | 393 +++++++++--------- tests/ui/suggestions/issue-68049-2.stderr | 8 +- 2 files changed, 201 insertions(+), 200 deletions(-) diff --git a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs index a98a07a74e58..6286033e0672 100644 --- a/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/mutability_errors.rs @@ -1,4 +1,4 @@ -use rustc_errors::{Applicability, Diagnostic}; +use rustc_errors::{Applicability, Diagnostic, DiagnosticBuilder, ErrorGuaranteed}; use rustc_hir as hir; use rustc_hir::intravisit::Visitor; use rustc_hir::Node; @@ -478,179 +478,6 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { match self.local_names[local] { Some(name) if !local_decl.from_compiler_desugaring() => { - let label = match *local_decl.local_info() { - LocalInfo::User(mir::BindingForm::ImplicitSelf(_)) => { - let (span, suggestion) = - suggest_ampmut_self(self.infcx.tcx, local_decl); - Some((true, span, suggestion)) - } - - LocalInfo::User(mir::BindingForm::Var(mir::VarBindingForm { - binding_mode: ty::BindingMode::BindByValue(_), - opt_ty_info, - .. - })) => { - // check if the RHS is from desugaring - let opt_assignment_rhs_span = - self.body.find_assignments(local).first().map(|&location| { - if let Some(mir::Statement { - source_info: _, - kind: - mir::StatementKind::Assign(box ( - _, - mir::Rvalue::Use(mir::Operand::Copy(place)), - )), - }) = self.body[location.block] - .statements - .get(location.statement_index) - { - self.body.local_decls[place.local].source_info.span - } else { - self.body.source_info(location).span - } - }); - match opt_assignment_rhs_span.and_then(|s| s.desugaring_kind()) { - // on for loops, RHS points to the iterator part - Some(DesugaringKind::ForLoop) => { - self.suggest_similar_mut_method_for_for_loop(&mut err); - err.span_label(opt_assignment_rhs_span.unwrap(), format!( - "this iterator yields `{pointer_sigil}` {pointer_desc}s", - )); - None - } - // don't create labels for compiler-generated spans - Some(_) => None, - None => { - let label = if name != kw::SelfLower { - suggest_ampmut( - self.infcx.tcx, - local_decl, - opt_assignment_rhs_span, - opt_ty_info, - ) - } else { - match local_decl.local_info() { - LocalInfo::User(mir::BindingForm::Var( - mir::VarBindingForm { - opt_ty_info: None, .. - }, - )) => { - let (span, sugg) = suggest_ampmut_self( - self.infcx.tcx, - local_decl, - ); - (true, span, sugg) - } - // explicit self (eg `self: &'a Self`) - _ => suggest_ampmut( - self.infcx.tcx, - local_decl, - opt_assignment_rhs_span, - opt_ty_info, - ), - } - }; - Some(label) - } - } - } - - LocalInfo::User(mir::BindingForm::Var(mir::VarBindingForm { - binding_mode: ty::BindingMode::BindByReference(_), - .. - })) => { - let pattern_span: Span = local_decl.source_info.span; - suggest_ref_mut(self.infcx.tcx, pattern_span) - .map(|span| (true, span, "mut ".to_owned())) - } - - _ => unreachable!(), - }; - - match label { - Some((true, err_help_span, suggested_code)) => { - let (is_trait_sig, local_trait) = self.is_error_in_trait(local); - if !is_trait_sig { - err.span_suggestion_verbose( - err_help_span, - format!( - "consider changing this to be a mutable {pointer_desc}" - ), - suggested_code, - Applicability::MachineApplicable, - ); - } else if let Some(x) = local_trait { - err.span_suggestion_verbose( - x, - format!( - "consider changing that to be a mutable {pointer_desc}" - ), - suggested_code, - Applicability::MachineApplicable, - ); - } - } - Some((false, err_label_span, message)) => { - struct BindingFinder { - span: Span, - hir_id: Option, - } - - impl<'tcx> Visitor<'tcx> for BindingFinder { - fn visit_stmt(&mut self, s: &'tcx hir::Stmt<'tcx>) { - if let hir::StmtKind::Local(local) = s.kind { - if local.pat.span == self.span { - self.hir_id = Some(local.hir_id); - } - } - hir::intravisit::walk_stmt(self, s); - } - } - let hir_map = self.infcx.tcx.hir(); - let def_id = self.body.source.def_id(); - let hir_id = hir_map.local_def_id_to_hir_id(def_id.expect_local()); - let node = hir_map.find(hir_id); - let hir_id = if let Some(hir::Node::Item(item)) = node - && let hir::ItemKind::Fn(.., body_id) = item.kind - { - let body = hir_map.body(body_id); - let mut v = BindingFinder { - span: err_label_span, - hir_id: None, - }; - v.visit_body(body); - v.hir_id - } else { - None - }; - if let Some(hir_id) = hir_id - && let Some(hir::Node::Local(local)) = hir_map.find(hir_id) - { - let (changing, span, sugg) = match local.ty { - Some(ty) => ("changing", ty.span, message), - None => ( - "specifying", - local.pat.span.shrink_to_hi(), - format!(": {message}"), - ), - }; - err.span_suggestion_verbose( - span, - format!("consider {changing} this binding's type"), - sugg, - Applicability::HasPlaceholders, - ); - } else { - err.span_label( - err_label_span, - format!( - "consider changing this binding's type to be: `{message}`" - ), - ); - } - } - None => {} - } err.span_label( span, format!( @@ -658,6 +485,8 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { so the data it refers to cannot be {acted_on}", ), ); + + self.suggest_make_local_mut(&mut err, local, name); } _ => { err.span_label( @@ -1131,6 +960,184 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { } } } + + fn suggest_make_local_mut( + &self, + err: &mut DiagnosticBuilder<'_, ErrorGuaranteed>, + local: Local, + name: Symbol, + ) { + let local_decl = &self.body.local_decls[local]; + + let (pointer_sigil, pointer_desc) = + if local_decl.ty.is_ref() { ("&", "reference") } else { ("*const", "pointer") }; + + let (is_trait_sig, local_trait) = self.is_error_in_trait(local); + if is_trait_sig && local_trait.is_none() { + return; + } + + let decl_span = match local_trait { + Some(span) => span, + None => local_decl.source_info.span, + }; + + let label = match *local_decl.local_info() { + LocalInfo::User(mir::BindingForm::ImplicitSelf(_)) => { + let suggestion = suggest_ampmut_self(self.infcx.tcx, decl_span); + Some((true, decl_span, suggestion)) + } + + LocalInfo::User(mir::BindingForm::Var(mir::VarBindingForm { + binding_mode: ty::BindingMode::BindByValue(_), + opt_ty_info, + .. + })) => { + // check if the RHS is from desugaring + let opt_assignment_rhs_span = + self.body.find_assignments(local).first().map(|&location| { + if let Some(mir::Statement { + source_info: _, + kind: + mir::StatementKind::Assign(box ( + _, + mir::Rvalue::Use(mir::Operand::Copy(place)), + )), + }) = self.body[location.block].statements.get(location.statement_index) + { + self.body.local_decls[place.local].source_info.span + } else { + self.body.source_info(location).span + } + }); + match opt_assignment_rhs_span.and_then(|s| s.desugaring_kind()) { + // on for loops, RHS points to the iterator part + Some(DesugaringKind::ForLoop) => { + self.suggest_similar_mut_method_for_for_loop(err); + err.span_label( + opt_assignment_rhs_span.unwrap(), + format!("this iterator yields `{pointer_sigil}` {pointer_desc}s",), + ); + None + } + // don't create labels for compiler-generated spans + Some(_) => None, + None => { + let label = if name != kw::SelfLower { + suggest_ampmut( + self.infcx.tcx, + local_decl.ty, + decl_span, + opt_assignment_rhs_span, + opt_ty_info, + ) + } else { + match local_decl.local_info() { + LocalInfo::User(mir::BindingForm::Var(mir::VarBindingForm { + opt_ty_info: None, + .. + })) => { + let sugg = suggest_ampmut_self(self.infcx.tcx, decl_span); + (true, decl_span, sugg) + } + // explicit self (eg `self: &'a Self`) + _ => suggest_ampmut( + self.infcx.tcx, + local_decl.ty, + decl_span, + opt_assignment_rhs_span, + opt_ty_info, + ), + } + }; + Some(label) + } + } + } + + LocalInfo::User(mir::BindingForm::Var(mir::VarBindingForm { + binding_mode: ty::BindingMode::BindByReference(_), + .. + })) => { + let pattern_span: Span = local_decl.source_info.span; + suggest_ref_mut(self.infcx.tcx, pattern_span) + .map(|span| (true, span, "mut ".to_owned())) + } + + _ => unreachable!(), + }; + + match label { + Some((true, err_help_span, suggested_code)) => { + err.span_suggestion_verbose( + err_help_span, + format!("consider changing this to be a mutable {pointer_desc}"), + suggested_code, + Applicability::MachineApplicable, + ); + } + Some((false, err_label_span, message)) => { + struct BindingFinder { + span: Span, + hir_id: Option, + } + + impl<'tcx> Visitor<'tcx> for BindingFinder { + fn visit_stmt(&mut self, s: &'tcx hir::Stmt<'tcx>) { + if let hir::StmtKind::Local(local) = s.kind { + if local.pat.span == self.span { + self.hir_id = Some(local.hir_id); + } + } + hir::intravisit::walk_stmt(self, s); + } + } + let hir_map = self.infcx.tcx.hir(); + let def_id = self.body.source.def_id(); + let hir_id = hir_map.local_def_id_to_hir_id(def_id.expect_local()); + let node = hir_map.find(hir_id); + let hir_id = if let Some(hir::Node::Item(item)) = node + && let hir::ItemKind::Fn(.., body_id) = item.kind + { + let body = hir_map.body(body_id); + let mut v = BindingFinder { + span: err_label_span, + hir_id: None, + }; + v.visit_body(body); + v.hir_id + } else { + None + }; + if let Some(hir_id) = hir_id + && let Some(hir::Node::Local(local)) = hir_map.find(hir_id) + { + let (changing, span, sugg) = match local.ty { + Some(ty) => ("changing", ty.span, message), + None => ( + "specifying", + local.pat.span.shrink_to_hi(), + format!(": {message}"), + ), + }; + err.span_suggestion_verbose( + span, + format!("consider {changing} this binding's type"), + sugg, + Applicability::HasPlaceholders, + ); + } else { + err.span_label( + err_label_span, + format!( + "consider changing this binding's type to be: `{message}`" + ), + ); + } + } + None => {} + } + } } pub fn mut_borrow_of_mutable_ref(local_decl: &LocalDecl<'_>, local_name: Option) -> bool { @@ -1160,25 +1167,18 @@ pub fn mut_borrow_of_mutable_ref(local_decl: &LocalDecl<'_>, local_name: Option< } } -fn suggest_ampmut_self<'tcx>( - tcx: TyCtxt<'tcx>, - local_decl: &mir::LocalDecl<'tcx>, -) -> (Span, String) { - let sp = local_decl.source_info.span; - ( - sp, - match tcx.sess.source_map().span_to_snippet(sp) { - Ok(snippet) => { - let lt_pos = snippet.find('\''); - if let Some(lt_pos) = lt_pos { - format!("&{}mut self", &snippet[lt_pos..snippet.len() - 4]) - } else { - "&mut self".to_string() - } +fn suggest_ampmut_self<'tcx>(tcx: TyCtxt<'tcx>, span: Span) -> String { + match tcx.sess.source_map().span_to_snippet(span) { + Ok(snippet) => { + let lt_pos = snippet.find('\''); + if let Some(lt_pos) = lt_pos { + format!("&{}mut self", &snippet[lt_pos..snippet.len() - 4]) + } else { + "&mut self".to_string() } - _ => "&mut self".to_string(), - }, - ) + } + _ => "&mut self".to_string(), + } } // When we want to suggest a user change a local variable to be a `&mut`, there @@ -1198,7 +1198,8 @@ fn suggest_ampmut_self<'tcx>( // by trying (3.), then (2.) and finally falling back on (1.). fn suggest_ampmut<'tcx>( tcx: TyCtxt<'tcx>, - local_decl: &mir::LocalDecl<'tcx>, + decl_ty: Ty<'tcx>, + decl_span: Span, opt_assignment_rhs_span: Option, opt_ty_info: Option, ) -> (bool, Span, String) { @@ -1250,7 +1251,7 @@ fn suggest_ampmut<'tcx>( // otherwise, we'll suggest *adding* an annotated type, we'll suggest // the RHS's type for that. // this is `Applicability::HasPlaceholders`. - None => (false, local_decl.source_info.span), + None => (false, decl_span), }; // if the binding already exists and is a reference with a explicit @@ -1271,13 +1272,13 @@ fn suggest_ampmut<'tcx>( } else { // otherwise, suggest that the user annotates the binding; we provide the // type of the local. - let ty_mut = local_decl.ty.builtin_deref(true).unwrap(); + let ty_mut = decl_ty.builtin_deref(true).unwrap(); assert_eq!(ty_mut.mutbl, hir::Mutability::Not); ( false, span, - format!("{}mut {}", if local_decl.ty.is_ref() {"&"} else {"*"}, ty_mut.ty) + format!("{}mut {}", if decl_ty.is_ref() {"&"} else {"*"}, ty_mut.ty) ) } } diff --git a/tests/ui/suggestions/issue-68049-2.stderr b/tests/ui/suggestions/issue-68049-2.stderr index 833799081598..6f3c78443f82 100644 --- a/tests/ui/suggestions/issue-68049-2.stderr +++ b/tests/ui/suggestions/issue-68049-2.stderr @@ -4,10 +4,10 @@ error[E0594]: cannot assign to `*input`, which is behind a `&` reference LL | *input = self.0; | ^^^^^^^^^^^^^^^ `input` is a `&` reference, so the data it refers to cannot be written | -help: consider changing that to be a mutable reference +help: consider changing this to be a mutable reference | -LL | fn example(&self, input: mut ); // should suggest here - | ~~~ +LL | fn example(&self, input: &mut i32) { // should not suggest here + | +++ error[E0594]: cannot assign to `self.0`, which is behind a `&` reference --> $DIR/issue-68049-2.rs:17:5 @@ -15,7 +15,7 @@ error[E0594]: cannot assign to `self.0`, which is behind a `&` reference LL | self.0 += *input; | ^^^^^^^^^^^^^^^^ `self` is a `&` reference, so the data it refers to cannot be written | -help: consider changing that to be a mutable reference +help: consider changing this to be a mutable reference | LL | fn example(&mut self, input: &i32); // should suggest here | ~~~~~~~~~ From bd928a0b5e144b0fafb2f4659a83aa362de7e3c7 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Fri, 5 May 2023 12:54:58 +0100 Subject: [PATCH 23/97] Disallow (min) specialization imps with no items Such implementations are usually mistakes and are not used in the compiler or standard library (after this commit) so forbid them with `min_specialization`. --- .../rustc_data_structures/src/owned_slice.rs | 2 ++ compiler/rustc_hir_analysis/messages.ftl | 3 +++ compiler/rustc_hir_analysis/src/errors.rs | 9 +++++++ .../src/impl_wf_check/min_specialization.rs | 15 +++++++++++- compiler/rustc_middle/src/mir/mod.rs | 2 -- ...fault-bound-non-const-specialized-bound.rs | 24 ++++++++++++++----- ...t-bound-non-const-specialized-bound.stderr | 4 ++-- .../issue-95186-specialize-on-tilde-const.rs | 24 ++++++++++++++----- ...87-same-trait-bound-different-constness.rs | 24 ++++++++++++++----- .../min_specialization/specialize_nothing.rs | 14 +++++++++++ .../specialize_nothing.stderr | 14 +++++++++++ 11 files changed, 112 insertions(+), 23 deletions(-) create mode 100644 tests/ui/specialization/min_specialization/specialize_nothing.rs create mode 100644 tests/ui/specialization/min_specialization/specialize_nothing.stderr diff --git a/compiler/rustc_data_structures/src/owned_slice.rs b/compiler/rustc_data_structures/src/owned_slice.rs index 048401f66c27..311a42aa42a3 100644 --- a/compiler/rustc_data_structures/src/owned_slice.rs +++ b/compiler/rustc_data_structures/src/owned_slice.rs @@ -109,9 +109,11 @@ impl Borrow<[u8]> for OwnedSlice { } // Safety: `OwnedSlice` is conceptually `(&'self.1 [u8], Box)`, which is `Send` +#[cfg(parallel_compiler)] unsafe impl Send for OwnedSlice {} // Safety: `OwnedSlice` is conceptually `(&'self.1 [u8], Box)`, which is `Sync` +#[cfg(parallel_compiler)] unsafe impl Sync for OwnedSlice {} #[cfg(test)] diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl index eaa75bde6c6c..c130eaae7554 100644 --- a/compiler/rustc_hir_analysis/messages.ftl +++ b/compiler/rustc_hir_analysis/messages.ftl @@ -275,6 +275,9 @@ hir_analysis_specialization_trait = implementing `rustc_specialization_trait` tr hir_analysis_closure_implicit_hrtb = implicit types in closure signatures are forbidden when `for<...>` is present .label = `for<...>` is here +hir_analysis_empty_specialization = specialization impl does not specialize any associated items + .note = impl is a specialization of this impl + hir_analysis_const_specialize = cannot specialize on const impl with non-const impl hir_analysis_static_specialize = cannot specialize on `'static` lifetime diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs index c0ee777722e7..32e91af2608d 100644 --- a/compiler/rustc_hir_analysis/src/errors.rs +++ b/compiler/rustc_hir_analysis/src/errors.rs @@ -803,6 +803,15 @@ pub(crate) struct ClosureImplicitHrtb { pub for_sp: Span, } +#[derive(Diagnostic)] +#[diag(hir_analysis_empty_specialization)] +pub(crate) struct EmptySpecialization { + #[primary_span] + pub span: Span, + #[note] + pub base_impl_span: Span, +} + #[derive(Diagnostic)] #[diag(hir_analysis_const_specialize)] pub(crate) struct ConstSpecialize { diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs index 5cca2dacb5c7..4f0df5c5677b 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs @@ -100,12 +100,19 @@ fn parent_specialization_node(tcx: TyCtxt<'_>, impl1_def_id: LocalDefId) -> Opti // Implementing a normal trait isn't a specialization. return None; } + if trait_def.is_marker { + // Overlapping marker implementations are not really specializations. + return None; + } Some(impl2_node) } /// Check that `impl1` is a sound specialization #[instrument(level = "debug", skip(tcx))] fn check_always_applicable(tcx: TyCtxt<'_>, impl1_def_id: LocalDefId, impl2_node: Node) { + let span = tcx.def_span(impl1_def_id); + check_has_items(tcx, impl1_def_id, impl2_node, span); + if let Some((impl1_substs, impl2_substs)) = get_impl_substs(tcx, impl1_def_id, impl2_node) { let impl2_def_id = impl2_node.def_id(); debug!(?impl2_def_id, ?impl2_substs); @@ -116,7 +123,6 @@ fn check_always_applicable(tcx: TyCtxt<'_>, impl1_def_id: LocalDefId, impl2_node unconstrained_parent_impl_substs(tcx, impl2_def_id, impl2_substs) }; - let span = tcx.def_span(impl1_def_id); check_constness(tcx, impl1_def_id, impl2_node, span); check_static_lifetimes(tcx, &parent_substs, span); check_duplicate_params(tcx, impl1_substs, &parent_substs, span); @@ -124,6 +130,13 @@ fn check_always_applicable(tcx: TyCtxt<'_>, impl1_def_id: LocalDefId, impl2_node } } +fn check_has_items(tcx: TyCtxt<'_>, impl1_def_id: LocalDefId, impl2_node: Node, span: Span) { + if let Node::Impl(impl2_id) = impl2_node && tcx.associated_item_def_ids(impl1_def_id).is_empty() { + let base_impl_span = tcx.def_span(impl2_id); + tcx.sess.emit_err(errors::EmptySpecialization { span, base_impl_span }); + } +} + /// Check that the specializing impl `impl1` is at least as const as the base /// impl `impl2` fn check_constness(tcx: TyCtxt<'_>, impl1_def_id: LocalDefId, impl2_node: Node, span: Span) { diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index 858a3d266ea3..f2841182a1a3 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -2728,8 +2728,6 @@ pub struct UserTypeProjection { pub projs: Vec, } -impl Copy for ProjectionKind {} - impl UserTypeProjection { pub(crate) fn index(mut self) -> Self { self.projs.push(ProjectionElem::Index(())); diff --git a/tests/ui/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs b/tests/ui/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs index 3ac909924864..f31123f16f14 100644 --- a/tests/ui/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs +++ b/tests/ui/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.rs @@ -12,7 +12,9 @@ trait Specialize {} trait Foo {} #[const_trait] -trait Bar {} +trait Bar { + fn bar(); +} // bgr360: I was only able to exercise the code path that raises the // "missing ~const qualifier" error by making this base impl non-const, even @@ -21,26 +23,36 @@ trait Bar {} impl Bar for T where T: ~const Foo, -{} +{ + default fn bar() {} +} impl Bar for T where T: Foo, //~ ERROR missing `~const` qualifier T: Specialize, -{} +{ + fn bar() {} +} #[const_trait] -trait Baz {} +trait Baz { + fn baz(); +} impl const Baz for T where T: ~const Foo, -{} +{ + default fn baz() {} +} impl const Baz for T //~ ERROR conflicting implementations of trait `Baz` where T: Foo, T: Specialize, -{} +{ + fn baz() {} +} fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr b/tests/ui/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr index 4aea1979421c..057cf4aea8a0 100644 --- a/tests/ui/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr +++ b/tests/ui/rfc-2632-const-trait-impl/specialization/const-default-bound-non-const-specialized-bound.stderr @@ -1,11 +1,11 @@ error: missing `~const` qualifier for specialization - --> $DIR/const-default-bound-non-const-specialized-bound.rs:28:8 + --> $DIR/const-default-bound-non-const-specialized-bound.rs:32:8 | LL | T: Foo, | ^^^ error[E0119]: conflicting implementations of trait `Baz` - --> $DIR/const-default-bound-non-const-specialized-bound.rs:40:1 + --> $DIR/const-default-bound-non-const-specialized-bound.rs:50:1 | LL | impl const Baz for T | ----------------------- first implementation here diff --git a/tests/ui/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs b/tests/ui/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs index 9c2c2cf1610a..92d8be6bb166 100644 --- a/tests/ui/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs +++ b/tests/ui/rfc-2632-const-trait-impl/specialization/issue-95186-specialize-on-tilde-const.rs @@ -11,27 +11,39 @@ trait Specialize {} #[const_trait] -trait Foo {} +trait Foo { + fn foo(); +} -impl const Foo for T {} +impl const Foo for T { + default fn foo() {} +} impl const Foo for T where T: ~const Specialize, -{} +{ + fn foo() {} +} #[const_trait] -trait Bar {} +trait Bar { + fn bar() {} +} impl const Bar for T where T: ~const Foo, -{} +{ + default fn bar() {} +} impl const Bar for T where T: ~const Foo, T: ~const Specialize, -{} +{ + fn bar() {} +} fn main() {} diff --git a/tests/ui/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs b/tests/ui/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs index 1e6b1c6513b3..51bfaf73b57b 100644 --- a/tests/ui/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs +++ b/tests/ui/rfc-2632-const-trait-impl/specialization/issue-95187-same-trait-bound-different-constness.rs @@ -15,31 +15,43 @@ trait Specialize {} trait Foo {} #[const_trait] -trait Bar {} +trait Bar { + fn bar(); +} impl Bar for T where T: Foo, -{} +{ + default fn bar() {} +} impl const Bar for T where T: ~const Foo, T: Specialize, -{} +{ + fn bar() {} +} #[const_trait] -trait Baz {} +trait Baz { + fn baz(); +} impl const Baz for T where T: Foo, -{} +{ + default fn baz() {} +} impl const Baz for T where T: ~const Foo, T: Specialize, -{} +{ + fn baz() {} +} fn main() {} diff --git a/tests/ui/specialization/min_specialization/specialize_nothing.rs b/tests/ui/specialization/min_specialization/specialize_nothing.rs new file mode 100644 index 000000000000..ef92254d4651 --- /dev/null +++ b/tests/ui/specialization/min_specialization/specialize_nothing.rs @@ -0,0 +1,14 @@ +#![feature(min_specialization)] + +trait Special { + fn be_special(); +} + +impl Special for T { + fn be_special() {} +} + +impl Special for usize {} +//~^ ERROR specialization impl does not specialize any associated items + +fn main() {} diff --git a/tests/ui/specialization/min_specialization/specialize_nothing.stderr b/tests/ui/specialization/min_specialization/specialize_nothing.stderr new file mode 100644 index 000000000000..65f73781cae2 --- /dev/null +++ b/tests/ui/specialization/min_specialization/specialize_nothing.stderr @@ -0,0 +1,14 @@ +error: specialization impl does not specialize any associated items + --> $DIR/specialize_nothing.rs:11:1 + | +LL | impl Special for usize {} + | ^^^^^^^^^^^^^^^^^^^^^^ + | +note: impl is a specialization of this impl + --> $DIR/specialize_nothing.rs:7:1 + | +LL | impl Special for T { + | ^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + From fafe9e71d5c949c41a5a562e44cc40d72c5f7244 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Fri, 5 May 2023 15:50:17 +0100 Subject: [PATCH 24/97] Normalize consistently for specializations --- .../src/traits/specialize/mod.rs | 39 +++++++++++-------- .../specialize-associated-type.rs | 37 ++++++++++++++++++ .../specialize_on_type_error.rs | 33 ++++++++++++++++ .../specialize_on_type_error.stderr | 12 ++++++ 4 files changed, 104 insertions(+), 17 deletions(-) create mode 100644 tests/ui/specialization/min_specialization/specialize-associated-type.rs create mode 100644 tests/ui/specialization/min_specialization/specialize_on_type_error.rs create mode 100644 tests/ui/specialization/min_specialization/specialize_on_type_error.stderr diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 233d35aed382..8bbebadb22aa 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -99,14 +99,13 @@ pub fn translate_substs<'tcx>( return source_substs; } - fulfill_implication(infcx, param_env, source_trait_ref, target_impl).unwrap_or_else( - |()| { + fulfill_implication(infcx, param_env, source_trait_ref, source_impl, target_impl) + .unwrap_or_else(|()| { bug!( "When translating substitutions from {source_impl:?} to {target_impl:?}, \ the expected specialization failed to hold" ) - }, - ) + }) } specialization_graph::Node::Trait(..) => source_trait_ref.substs, }; @@ -153,20 +152,9 @@ pub(super) fn specializes(tcx: TyCtxt<'_>, (impl1_def_id, impl2_def_id): (DefId, // Create an infcx, taking the predicates of impl1 as assumptions: let infcx = tcx.infer_ctxt().build(); - let impl1_trait_ref = - match traits::fully_normalize(&infcx, ObligationCause::dummy(), penv, impl1_trait_ref) { - Ok(impl1_trait_ref) => impl1_trait_ref, - Err(_errors) => { - tcx.sess.delay_span_bug( - tcx.def_span(impl1_def_id), - format!("failed to fully normalize {impl1_trait_ref}"), - ); - impl1_trait_ref - } - }; // Attempt to prove that impl2 applies, given all of the above. - fulfill_implication(&infcx, penv, impl1_trait_ref, impl2_def_id).is_ok() + fulfill_implication(&infcx, penv, impl1_trait_ref, impl1_def_id, impl2_def_id).is_ok() } /// Attempt to fulfill all obligations of `target_impl` after unification with @@ -178,6 +166,7 @@ fn fulfill_implication<'tcx>( infcx: &InferCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, source_trait_ref: ty::TraitRef<'tcx>, + source_impl: DefId, target_impl: DefId, ) -> Result, ()> { debug!( @@ -185,6 +174,22 @@ fn fulfill_implication<'tcx>( param_env, source_trait_ref, target_impl ); + let source_trait_ref = match traits::fully_normalize( + &infcx, + ObligationCause::dummy(), + param_env, + source_trait_ref, + ) { + Ok(source_trait_ref) => source_trait_ref, + Err(_errors) => { + infcx.tcx.sess.delay_span_bug( + infcx.tcx.def_span(source_impl), + format!("failed to fully normalize {source_trait_ref}"), + ); + source_trait_ref + } + }; + let source_trait = ImplSubject::Trait(source_trait_ref); let selcx = &mut SelectionContext::new(&infcx); @@ -194,7 +199,7 @@ fn fulfill_implication<'tcx>( // do the impls unify? If not, no specialization. let Ok(InferOk { obligations: more_obligations, .. }) = - infcx.at(&ObligationCause::dummy(), param_env, ).eq(DefineOpaqueTypes::No,source_trait, target_trait) + infcx.at(&ObligationCause::dummy(), param_env).eq(DefineOpaqueTypes::No, source_trait, target_trait) else { debug!( "fulfill_implication: {:?} does not unify with {:?}", diff --git a/tests/ui/specialization/min_specialization/specialize-associated-type.rs b/tests/ui/specialization/min_specialization/specialize-associated-type.rs new file mode 100644 index 000000000000..c4960b0c28e7 --- /dev/null +++ b/tests/ui/specialization/min_specialization/specialize-associated-type.rs @@ -0,0 +1,37 @@ +// Another regression test for #109815. + +// check-pass + +#![feature(min_specialization)] +#![feature(rustc_attrs)] + +#[rustc_specialization_trait] +trait X {} +trait Z { + type Assoc: X; +} +struct A(T); + +impl X for () {} + +impl Z for A { + type Assoc = (); +} + +trait MyFrom { + fn from(other: T) -> Self; +} + +impl MyFrom<()> for T { + default fn from(other: ()) -> T { + panic!(); + } +} + +impl MyFrom< as Z>::Assoc> for T { + fn from(other: ()) -> T { + panic!(); + } +} + +fn main() {} diff --git a/tests/ui/specialization/min_specialization/specialize_on_type_error.rs b/tests/ui/specialization/min_specialization/specialize_on_type_error.rs new file mode 100644 index 000000000000..24e92a0abc33 --- /dev/null +++ b/tests/ui/specialization/min_specialization/specialize_on_type_error.rs @@ -0,0 +1,33 @@ +// A regression test for #109815. + +#![feature(min_specialization)] +#![feature(rustc_attrs)] + +#[rustc_specialization_trait] +trait X {} +trait Y: X {} +trait Z { + type Assoc: Y; +} +struct A(T); + +impl Z for A {} +//~^ ERROR not all trait items implemented + +trait MyFrom { + fn from(other: T) -> Self; +} + +impl MyFrom for T { + default fn from(other: T) -> T { + other + } +} + +impl MyFrom< as Z>::Assoc> for T { + fn from(other: as Z>::Assoc) -> T { + other + } +} + +fn main() {} diff --git a/tests/ui/specialization/min_specialization/specialize_on_type_error.stderr b/tests/ui/specialization/min_specialization/specialize_on_type_error.stderr new file mode 100644 index 000000000000..cc12302bd8cf --- /dev/null +++ b/tests/ui/specialization/min_specialization/specialize_on_type_error.stderr @@ -0,0 +1,12 @@ +error[E0046]: not all trait items implemented, missing: `Assoc` + --> $DIR/specialize_on_type_error.rs:14:1 + | +LL | type Assoc: Y; + | ------------- `Assoc` from trait +... +LL | impl Z for A {} + | ^^^^^^^^^^^^^^^^^^^^^ missing `Assoc` in implementation + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0046`. From 26b413eb2ec6fe782e4659998ab0e91be1528401 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Fri, 5 May 2023 18:54:06 +0100 Subject: [PATCH 25/97] Further normalize msvc-non-utf8-ouput --- .../ui/native-library-link-flags/msvc-non-utf8-output.rs | 5 ++--- .../native-library-link-flags/msvc-non-utf8-output.stderr | 8 +------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs b/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs index 3fb2842d694c..19b9a17705b9 100644 --- a/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs +++ b/tests/ui/native-library-link-flags/msvc-non-utf8-output.rs @@ -1,6 +1,5 @@ // build-fail -// compile-flags:-C link-arg=märchenhaft +// compile-flags:-C link-arg=⦺ⅈ⽯⭏⽽◃⡽⚞ // only-msvc -// error-pattern:= note: LINK : fatal error LNK1181: -// normalize-stderr-test "(\s*\|\n)\s*= note: .*\n" -> "$1" +// normalize-stderr-test "(?:.|\n)*(⦺ⅈ⽯⭏⽽◃⡽⚞)(?:.|\n)*" -> "$1" pub fn main() {} diff --git a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr b/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr index f843aad782c3..7f3ef376447a 100644 --- a/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr +++ b/tests/ui/native-library-link-flags/msvc-non-utf8-output.stderr @@ -1,7 +1 @@ -error: linking with `link.exe` failed: exit code: 1181 - | - = note: LINK : fatal error LNK1181: cannot open input file 'märchenhaft.obj' - - -error: aborting due to previous error - +⦺ⅈ⽯⭏⽽◃⡽⚞ \ No newline at end of file From 68a5bb4de153565d93e084904154439777ad5c31 Mon Sep 17 00:00:00 2001 From: Charisee Date: Fri, 5 May 2023 18:32:20 +0000 Subject: [PATCH 26/97] Add GNU Property Note --- .../rustc_codegen_ssa/src/back/metadata.rs | 26 +++++++++++-------- .../branch-protection-check-IBT/Makefile | 15 +++++++++++ .../branch-protection-check-IBT/main.rs | 3 +++ 3 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 tests/run-make/branch-protection-check-IBT/Makefile create mode 100644 tests/run-make/branch-protection-check-IBT/main.rs diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index baf674cf9eba..d4515a794ee5 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -98,6 +98,7 @@ fn add_gnu_property_note( file: &mut write::Object<'static>, architecture: Architecture, binary_format: BinaryFormat, + endianness: Endianness, ) { // check bti protection if binary_format != BinaryFormat::Elf @@ -115,12 +116,12 @@ fn add_gnu_property_note( let n_namsz: u32 = 4; // Size of the n_name field let n_descsz: u32 = 16; // Size of the n_desc field let n_type: u32 = NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor - let values = [n_namsz, n_descsz, n_type]; - values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))); - data.push(b'G'); // Owner of the program property note - data.push(b'N'); - data.push(b'U'); - data.push(0); + let header_values = [n_namsz, n_descsz, n_type]; + match endianness { + Endianness::Little => header_values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))), + Endianness::Big => header_values.map(|v| data.extend_from_slice(&(v.to_be_bytes()))), + }; + data.extend_from_slice(b"GNU\0"); // Owner of the program property note let pr_type: u32 = match architecture { Architecture::X86_64 => 0xc0000002, Architecture::Aarch64 => 0xc0000000, @@ -128,10 +129,13 @@ fn add_gnu_property_note( }; let pr_datasz: u32 = 4; //size of the pr_data field let pr_data: u32 = 3; //program property descriptor - let pr_padding: u32 = 3; - let values = [pr_type, pr_datasz, pr_data, pr_padding]; - values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))); - file.append_section_data(section, &data, 4); + let pr_padding: u32 = 0; + let property_values = [pr_type, pr_datasz, pr_data, pr_padding]; + match endianness { + Endianness::Little => property_values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))), + Endianness::Big => property_values.map(|v| data.extend_from_slice(&(v.to_be_bytes()))), + }; + file.append_section_data(section, &data, 8); } pub(crate) fn create_object_file(sess: &Session) -> Option> { @@ -246,7 +250,7 @@ pub(crate) fn create_object_file(sess: &Session) -> Option elf::ELFOSABI_NONE, }; let abi_version = 0; - add_gnu_property_note(&mut file, architecture, binary_format); + add_gnu_property_note(&mut file, architecture, binary_format, endianness); file.flags = FileFlags::Elf { os_abi, abi_version, e_flags }; Some(file) } diff --git a/tests/run-make/branch-protection-check-IBT/Makefile b/tests/run-make/branch-protection-check-IBT/Makefile new file mode 100644 index 000000000000..cabe951e1c5c --- /dev/null +++ b/tests/run-make/branch-protection-check-IBT/Makefile @@ -0,0 +1,15 @@ +# Check for GNU Property Note + +include ../tools.mk + +# How to run this +# python3 x.py test --target x86_64-unknown-linux-gnu tests/run-make/branch-protection-check-IBT/ + +# only-x86_64 + +all: +ifeq ($(filter x86,$(LLVM_COMPONENTS)),x86_64) + $(RUSTC) --target x86_64-unknown-linux-gnu -Z cf-protection=branch -L$(TMPDIR) -C link-args='-nostartfiles' -C save-temps ./main.rs -o $(TMPDIR)/rsmain + readelf -nW $(TMPDIR)/rsmain | $(CGREP) -e ".note.gnu.property" +endif + diff --git a/tests/run-make/branch-protection-check-IBT/main.rs b/tests/run-make/branch-protection-check-IBT/main.rs new file mode 100644 index 000000000000..ad379d6ea437 --- /dev/null +++ b/tests/run-make/branch-protection-check-IBT/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("hello world"); +} From 81c2459af69ff726df0a1aee17b15e7616e5ef5f Mon Sep 17 00:00:00 2001 From: bors Date: Fri, 5 May 2023 12:50:59 +0000 Subject: [PATCH 27/97] Stabilize const_ptr_read --- library/alloc/src/lib.rs | 1 - library/core/src/intrinsics.rs | 2 +- library/core/src/lib.rs | 1 - library/core/src/ptr/const_ptr.rs | 4 +-- library/core/src/ptr/mod.rs | 6 ++-- library/core/src/ptr/mut_ptr.rs | 4 +-- library/core/tests/lib.rs | 1 - src/tools/miri/tests/fail/const-ub-checks.rs | 1 - .../ui/const-generics/issues/issue-105821.rs | 2 +- tests/ui/const-ptr/out_of_bounds_read.rs | 2 -- tests/ui/const-ptr/out_of_bounds_read.stderr | 6 ++-- tests/ui/consts/const-eval/ub-ref-ptr.rs | 1 - tests/ui/consts/const-eval/ub-ref-ptr.stderr | 34 +++++++++---------- .../consts/extra-const-ub/detect-extra-ub.rs | 1 - .../detect-extra-ub.with_flag.stderr | 8 ++--- tests/ui/consts/issue-miri-1910.rs | 1 - tests/ui/consts/issue-miri-1910.stderr | 2 +- 17 files changed, 35 insertions(+), 42 deletions(-) diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 18f25aec5fee..59fa91c1066d 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -113,7 +113,6 @@ #![feature(const_maybe_uninit_write)] #![feature(const_maybe_uninit_zeroed)] #![feature(const_pin)] -#![feature(const_ptr_read)] #![feature(const_refs_to_cell)] #![feature(const_size_of_val)] #![feature(const_waker)] diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 077c0fdc380b..ff5f4867afb2 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -2260,7 +2260,7 @@ extern "rust-intrinsic" { /// This intrinsic can *only* be called where the pointer is a local without /// projections (`read_via_copy(ptr)`, not `read_via_copy(*ptr)`) so that it /// trivially obeys runtime-MIR rules about derefs in operands. - #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] + #[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")] #[rustc_nounwind] pub fn read_via_copy(ptr: *const T) -> T; diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index ed0c05a68631..c9b49da069a0 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -140,7 +140,6 @@ #![feature(const_pointer_is_aligned)] #![feature(const_ptr_as_ref)] #![feature(const_ptr_is_null)] -#![feature(const_ptr_read)] #![feature(const_ptr_sub_ptr)] #![feature(const_ptr_write)] #![feature(const_raw_ptr_comparison)] diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 585b648873a6..5ee1b5e4afc7 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -1195,7 +1195,7 @@ impl *const T { /// /// [`ptr::read`]: crate::ptr::read() #[stable(feature = "pointer_methods", since = "1.26.0")] - #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] + #[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")] #[inline] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn read(self) -> T @@ -1236,7 +1236,7 @@ impl *const T { /// /// [`ptr::read_unaligned`]: crate::ptr::read_unaligned() #[stable(feature = "pointer_methods", since = "1.26.0")] - #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] + #[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")] #[inline] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn read_unaligned(self) -> T diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 4737ff5d756d..ecbf4e66fa48 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1133,7 +1133,8 @@ pub const unsafe fn replace(dst: *mut T, mut src: T) -> T { /// [valid]: self#safety #[inline] #[stable(feature = "rust1", since = "1.0.0")] -#[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] +#[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")] +#[rustc_allow_const_fn_unstable(const_mut_refs, const_maybe_uninit_as_mut_ptr)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn read(src: *const T) -> T { // It would be semantically correct to implement this via `copy_nonoverlapping` @@ -1249,7 +1250,8 @@ pub const unsafe fn read(src: *const T) -> T { /// ``` #[inline] #[stable(feature = "ptr_unaligned", since = "1.17.0")] -#[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] +#[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")] +#[rustc_allow_const_fn_unstable(const_mut_refs, const_maybe_uninit_as_mut_ptr)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn read_unaligned(src: *const T) -> T { let mut tmp = MaybeUninit::::uninit(); diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index c339ccb1b4dd..5edd291fb76a 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -1305,7 +1305,7 @@ impl *mut T { /// /// [`ptr::read`]: crate::ptr::read() #[stable(feature = "pointer_methods", since = "1.26.0")] - #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] + #[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")] #[inline(always)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn read(self) -> T @@ -1346,7 +1346,7 @@ impl *mut T { /// /// [`ptr::read_unaligned`]: crate::ptr::read_unaligned() #[stable(feature = "pointer_methods", since = "1.26.0")] - #[rustc_const_unstable(feature = "const_ptr_read", issue = "80377")] + #[rustc_const_stable(feature = "const_ptr_read", since = "CURRENT_RUSTC_VERSION")] #[inline(always)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn read_unaligned(self) -> T diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index 84859a54c260..3c49d1705e5c 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -18,7 +18,6 @@ #![feature(const_pointer_byte_offsets)] #![feature(const_pointer_is_aligned)] #![feature(const_ptr_as_ref)] -#![feature(const_ptr_read)] #![feature(const_ptr_write)] #![feature(const_trait_impl)] #![feature(const_likely)] diff --git a/src/tools/miri/tests/fail/const-ub-checks.rs b/src/tools/miri/tests/fail/const-ub-checks.rs index fa522c30cbd0..ff265fba6e2f 100644 --- a/src/tools/miri/tests/fail/const-ub-checks.rs +++ b/src/tools/miri/tests/fail/const-ub-checks.rs @@ -1,4 +1,3 @@ -#![feature(const_ptr_read)] const UNALIGNED_READ: () = unsafe { let x = &[0u8; 4]; diff --git a/tests/ui/const-generics/issues/issue-105821.rs b/tests/ui/const-generics/issues/issue-105821.rs index cba2e22c4602..6cfabb65efb2 100644 --- a/tests/ui/const-generics/issues/issue-105821.rs +++ b/tests/ui/const-generics/issues/issue-105821.rs @@ -1,7 +1,7 @@ // check-pass #![allow(incomplete_features)] -#![feature(adt_const_params, const_ptr_read, generic_const_exprs)] +#![feature(adt_const_params, generic_const_exprs)] #![allow(dead_code)] const fn catone(_a: &[u8; M]) -> [u8; M + 1] diff --git a/tests/ui/const-ptr/out_of_bounds_read.rs b/tests/ui/const-ptr/out_of_bounds_read.rs index 9dd669180da0..a371aa93c5ee 100644 --- a/tests/ui/const-ptr/out_of_bounds_read.rs +++ b/tests/ui/const-ptr/out_of_bounds_read.rs @@ -1,7 +1,5 @@ // error-pattern: evaluation of constant value failed -#![feature(const_ptr_read)] - fn main() { use std::ptr; diff --git a/tests/ui/const-ptr/out_of_bounds_read.stderr b/tests/ui/const-ptr/out_of_bounds_read.stderr index 89536f53f08b..c5c0a1cdefcb 100644 --- a/tests/ui/const-ptr/out_of_bounds_read.stderr +++ b/tests/ui/const-ptr/out_of_bounds_read.stderr @@ -6,7 +6,7 @@ error[E0080]: evaluation of constant value failed note: inside `std::ptr::read::` --> $SRC_DIR/core/src/ptr/mod.rs:LL:COL note: inside `_READ` - --> $DIR/out_of_bounds_read.rs:12:33 + --> $DIR/out_of_bounds_read.rs:10:33 | LL | const _READ: u32 = unsafe { ptr::read(PAST_END_PTR) }; | ^^^^^^^^^^^^^^^^^^^^^^^ @@ -21,7 +21,7 @@ note: inside `std::ptr::read::` note: inside `ptr::const_ptr::::read` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `_CONST_READ` - --> $DIR/out_of_bounds_read.rs:13:39 + --> $DIR/out_of_bounds_read.rs:11:39 | LL | const _CONST_READ: u32 = unsafe { PAST_END_PTR.read() }; | ^^^^^^^^^^^^^^^^^^^ @@ -36,7 +36,7 @@ note: inside `std::ptr::read::` note: inside `ptr::mut_ptr::::read` --> $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL note: inside `_MUT_READ` - --> $DIR/out_of_bounds_read.rs:14:37 + --> $DIR/out_of_bounds_read.rs:12:37 | LL | const _MUT_READ: u32 = unsafe { (PAST_END_PTR as *mut u32).read() }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.rs b/tests/ui/consts/const-eval/ub-ref-ptr.rs index 369e4519407f..a5d2ea014865 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.rs +++ b/tests/ui/consts/const-eval/ub-ref-ptr.rs @@ -3,7 +3,6 @@ // normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)" // normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*a(lloc)?[0-9]+(\+[a-z0-9]+)?─*╼ )+ *│.*" -> "HEX_DUMP" #![allow(invalid_value)] -#![feature(const_ptr_read)] use std::mem; diff --git a/tests/ui/consts/const-eval/ub-ref-ptr.stderr b/tests/ui/consts/const-eval/ub-ref-ptr.stderr index 080568b51ef7..1d19dfff50b3 100644 --- a/tests/ui/consts/const-eval/ub-ref-ptr.stderr +++ b/tests/ui/consts/const-eval/ub-ref-ptr.stderr @@ -1,5 +1,5 @@ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:16:1 + --> $DIR/ub-ref-ptr.rs:15:1 | LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; | ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 2 byte alignment but found 1) @@ -10,7 +10,7 @@ LL | const UNALIGNED: &u16 = unsafe { mem::transmute(&[0u8; 4]) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:20:1 + --> $DIR/ub-ref-ptr.rs:19:1 | LL | const UNALIGNED_BOX: Box = unsafe { mem::transmute(&[0u8; 4]) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned box (required 2 byte alignment but found 1) @@ -21,7 +21,7 @@ LL | const UNALIGNED_BOX: Box = unsafe { mem::transmute(&[0u8; 4]) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:24:1 + --> $DIR/ub-ref-ptr.rs:23:1 | LL | const NULL: &u16 = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null reference @@ -32,7 +32,7 @@ LL | const NULL: &u16 = unsafe { mem::transmute(0usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:27:1 + --> $DIR/ub-ref-ptr.rs:26:1 | LL | const NULL_BOX: Box = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a null box @@ -43,7 +43,7 @@ LL | const NULL_BOX: Box = unsafe { mem::transmute(0usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:34:1 + --> $DIR/ub-ref-ptr.rs:33:1 | LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -52,7 +52,7 @@ LL | const REF_AS_USIZE: usize = unsafe { mem::transmute(&0) }; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:37:39 + --> $DIR/ub-ref-ptr.rs:36:39 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -61,13 +61,13 @@ LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported note: erroneous constant used - --> $DIR/ub-ref-ptr.rs:37:38 + --> $DIR/ub-ref-ptr.rs:36:38 | LL | const REF_AS_USIZE_SLICE: &[usize] = &[unsafe { mem::transmute(&0) }]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:40:86 + --> $DIR/ub-ref-ptr.rs:39:86 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; | ^^^^^^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -76,13 +76,13 @@ LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[us = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported note: erroneous constant used - --> $DIR/ub-ref-ptr.rs:40:85 + --> $DIR/ub-ref-ptr.rs:39:85 | LL | const REF_AS_USIZE_BOX_SLICE: Box<[usize]> = unsafe { mem::transmute::<&[usize], _>(&[mem::transmute(&0)]) }; | ^^^^^^^^^^^^^^^^^^^^^ error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:43:1 + --> $DIR/ub-ref-ptr.rs:42:1 | LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling reference (0x539[noalloc] has no provenance) @@ -93,7 +93,7 @@ LL | const USIZE_AS_REF: &'static u8 = unsafe { mem::transmute(1337usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:46:1 + --> $DIR/ub-ref-ptr.rs:45:1 | LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a dangling box (0x539[noalloc] has no provenance) @@ -104,13 +104,13 @@ LL | const USIZE_AS_BOX: Box = unsafe { mem::transmute(1337usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:49:41 + --> $DIR/ub-ref-ptr.rs:48:41 | LL | const UNINIT_PTR: *const i32 = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:53:1 + --> $DIR/ub-ref-ptr.rs:52:1 | LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered null pointer, but expected a function pointer @@ -121,13 +121,13 @@ LL | const NULL_FN_PTR: fn() = unsafe { mem::transmute(0usize) }; } error[E0080]: evaluation of constant value failed - --> $DIR/ub-ref-ptr.rs:55:38 + --> $DIR/ub-ref-ptr.rs:54:38 | LL | const UNINIT_FN_PTR: fn() = unsafe { MaybeUninit { uninit: () }.init }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ using uninitialized data, but this operation requires initialized memory error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:58:1 + --> $DIR/ub-ref-ptr.rs:57:1 | LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered 0xd[noalloc], but expected a function pointer @@ -138,7 +138,7 @@ LL | const DANGLING_FN_PTR: fn() = unsafe { mem::transmute(13usize) }; } error[E0080]: it is undefined behavior to use this value - --> $DIR/ub-ref-ptr.rs:60:1 + --> $DIR/ub-ref-ptr.rs:59:1 | LL | const DATA_FN_PTR: fn() = unsafe { mem::transmute(&13) }; | ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered alloc41, but expected a function pointer @@ -158,7 +158,7 @@ note: inside `std::ptr::read::` note: inside `ptr::const_ptr::::read` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `UNALIGNED_READ` - --> $DIR/ub-ref-ptr.rs:67:5 + --> $DIR/ub-ref-ptr.rs:66:5 | LL | ptr.read(); | ^^^^^^^^^^ diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs index e2f8149883b1..6a3c93ce7a67 100644 --- a/tests/ui/consts/extra-const-ub/detect-extra-ub.rs +++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.rs @@ -1,7 +1,6 @@ // revisions: no_flag with_flag // [no_flag] check-pass // [with_flag] compile-flags: -Zextra-const-ub-checks -#![feature(const_ptr_read)] use std::mem::transmute; diff --git a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr index b2a5fd90149a..3970baefcb35 100644 --- a/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr +++ b/tests/ui/consts/extra-const-ub/detect-extra-ub.with_flag.stderr @@ -1,11 +1,11 @@ error[E0080]: evaluation of constant value failed - --> $DIR/detect-extra-ub.rs:9:20 + --> $DIR/detect-extra-ub.rs:8:20 | LL | let _x: bool = transmute(3u8); | ^^^^^^^^^^^^^^ constructing invalid value: encountered 0x03, but expected a boolean error[E0080]: evaluation of constant value failed - --> $DIR/detect-extra-ub.rs:15:21 + --> $DIR/detect-extra-ub.rs:14:21 | LL | let _x: usize = transmute(&3u8); | ^^^^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -14,7 +14,7 @@ LL | let _x: usize = transmute(&3u8); = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/detect-extra-ub.rs:21:30 + --> $DIR/detect-extra-ub.rs:20:30 | LL | let _x: (usize, usize) = transmute(x); | ^^^^^^^^^^^^ unable to turn pointer into raw bytes @@ -23,7 +23,7 @@ LL | let _x: (usize, usize) = transmute(x); = help: the absolute address of a pointer is not known at compile-time, so such operations are not supported error[E0080]: evaluation of constant value failed - --> $DIR/detect-extra-ub.rs:26:20 + --> $DIR/detect-extra-ub.rs:25:20 | LL | let _x: &u32 = transmute(&[0u8; 4]); | ^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered an unaligned reference (required 4 byte alignment but found 1) diff --git a/tests/ui/consts/issue-miri-1910.rs b/tests/ui/consts/issue-miri-1910.rs index 29e0ea950264..3798332dfd78 100644 --- a/tests/ui/consts/issue-miri-1910.rs +++ b/tests/ui/consts/issue-miri-1910.rs @@ -1,6 +1,5 @@ // error-pattern unable to turn pointer into raw bytes // normalize-stderr-test: "alloc[0-9]+\+0x[a-z0-9]+" -> "ALLOC" -#![feature(const_ptr_read)] const C: () = unsafe { let foo = Some(&42 as *const i32); diff --git a/tests/ui/consts/issue-miri-1910.stderr b/tests/ui/consts/issue-miri-1910.stderr index a10eea9de114..fb758d406b55 100644 --- a/tests/ui/consts/issue-miri-1910.stderr +++ b/tests/ui/consts/issue-miri-1910.stderr @@ -10,7 +10,7 @@ note: inside `std::ptr::read::` note: inside `ptr::const_ptr::::read` --> $SRC_DIR/core/src/ptr/const_ptr.rs:LL:COL note: inside `C` - --> $DIR/issue-miri-1910.rs:8:5 + --> $DIR/issue-miri-1910.rs:7:5 | LL | (&foo as *const _ as *const u8).add(one_and_a_half_pointers).read(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ From 1fc0442f7e6eaf0848ceb7230df9fe03d4e6630d Mon Sep 17 00:00:00 2001 From: Charisee Date: Fri, 5 May 2023 19:06:14 +0000 Subject: [PATCH 28/97] rewriting match on endianness --- compiler/rustc_codegen_ssa/src/back/metadata.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index d4515a794ee5..ab805089be5f 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -117,10 +117,17 @@ fn add_gnu_property_note( let n_descsz: u32 = 16; // Size of the n_desc field let n_type: u32 = NT_GNU_PROPERTY_TYPE_0; // Type of note descriptor let header_values = [n_namsz, n_descsz, n_type]; + header_values.iter().for_each(|v| { + data.extend_from_slice(&match endianness { + Endianness::Little => v.to_le_bytes(), + Endianness::Big => v.to_be_bytes(), + }) + }); + /* match endianness { Endianness::Little => header_values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))), Endianness::Big => header_values.map(|v| data.extend_from_slice(&(v.to_be_bytes()))), - }; + };*/ data.extend_from_slice(b"GNU\0"); // Owner of the program property note let pr_type: u32 = match architecture { Architecture::X86_64 => 0xc0000002, From f2cf795af444792500c156487e71e4a4298de95c Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Fri, 5 May 2023 16:24:51 -0300 Subject: [PATCH 29/97] Make generics_of has_self on RPITITs delegate to the opaque --- compiler/rustc_ty_utils/src/assoc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/rustc_ty_utils/src/assoc.rs b/compiler/rustc_ty_utils/src/assoc.rs index de1e1a527d5a..9029ba2a51aa 100644 --- a/compiler/rustc_ty_utils/src/assoc.rs +++ b/compiler/rustc_ty_utils/src/assoc.rs @@ -334,7 +334,7 @@ fn associated_type_for_impl_trait_in_trait( parent_count, params, param_def_id_to_index, - has_self: false, + has_self: opaque_ty_generics.has_self, has_late_bound_regions: opaque_ty_generics.has_late_bound_regions, } }); From 59ecbd2cea20839f1288b917cbf5ba8c23864df7 Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 19 Jan 2023 10:24:17 +0100 Subject: [PATCH 30/97] Add parsing for builtin # in expression and item context --- compiler/rustc_parse/messages.ftl | 4 +++ compiler/rustc_parse/src/errors.rs | 15 +++++++++ compiler/rustc_parse/src/parser/expr.rs | 42 +++++++++++++++++++++++++ compiler/rustc_parse/src/parser/item.rs | 8 +++++ compiler/rustc_parse/src/parser/stmt.rs | 6 +++- compiler/rustc_span/src/symbol.rs | 1 + tests/ui/parser/builtin-syntax.rs | 7 +++++ tests/ui/parser/builtin-syntax.stderr | 14 +++++++++ 8 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 tests/ui/parser/builtin-syntax.rs create mode 100644 tests/ui/parser/builtin-syntax.stderr diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl index cd296dca133f..711447a0af07 100644 --- a/compiler/rustc_parse/messages.ftl +++ b/compiler/rustc_parse/messages.ftl @@ -257,6 +257,10 @@ parse_invalid_literal_suffix_on_tuple_index = suffixes on a tuple index are inva .tuple_exception_line_2 = on proc macros, you'll want to use `syn::Index::from` or `proc_macro::Literal::*_unsuffixed` for code that will desugar to tuple field access .tuple_exception_line_3 = see issue #60210 for more information +parse_expected_builtin_ident = expected identifier after `builtin #` + +parse_unknown_builtin_construct = unknown `builtin #` construct `{$name}` + parse_non_string_abi_literal = non-string ABI literal .suggestion = specify the ABI with a string literal diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 010a13aefa42..0810f0efef98 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -2644,3 +2644,18 @@ pub(crate) struct MalformedCfgAttr { pub span: Span, pub sugg: &'static str, } + +#[derive(Diagnostic)] +#[diag(parse_unknown_builtin_construct)] +pub(crate) struct UnknownBuiltinConstruct { + #[primary_span] + pub span: Span, + pub name: Symbol, +} + +#[derive(Diagnostic)] +#[diag(parse_expected_builtin_ident)] +pub(crate) struct ExpectedBuiltinIdent { + #[primary_span] + pub span: Span, +} diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 61396ee0d4ae..844cf3359628 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1300,6 +1300,8 @@ impl<'a> Parser<'a> { }) } else if self.check(&token::OpenDelim(Delimiter::Bracket)) { self.parse_expr_array_or_repeat(Delimiter::Bracket) + } else if self.is_builtin() { + self.parse_expr_builtin() } else if self.check_path() { self.parse_expr_path_start() } else if self.check_keyword(kw::Move) @@ -1755,6 +1757,42 @@ impl<'a> Parser<'a> { self.maybe_recover_from_bad_qpath(expr) } + /// Parse `builtin # ident(args,*)`. + fn parse_expr_builtin(&mut self) -> PResult<'a, P> { + self.parse_builtin(|_this, _lo, _ident| { + Ok(None) + }) + } + + pub(crate) fn parse_builtin( + &mut self, + parse: impl FnOnce(&mut Parser<'a>, Span, Ident) -> PResult<'a, Option>, + ) -> PResult<'a, T> { + let lo = self.token.span; + + self.bump(); // `builtin` + self.bump(); // `#` + + let Some((ident, false)) = self.token.ident() else { + let err = errors::ExpectedBuiltinIdent { span: self.token.span } + .into_diagnostic(&self.sess.span_diagnostic); + return Err(err); + }; + self.bump(); + + self.expect(&TokenKind::OpenDelim(Delimiter::Parenthesis))?; + let ret = if let Some(res) = parse(self, lo, ident)? { + Ok(res) + } else { + let err = errors::UnknownBuiltinConstruct { span: lo.to(ident.span), name: ident.name } + .into_diagnostic(&self.sess.span_diagnostic); + return Err(err); + }; + self.expect(&TokenKind::CloseDelim(Delimiter::Parenthesis))?; + + ret + } + /// Returns a string literal if the next token is a string literal. /// In case of error returns `Some(lit)` if the next token is a literal with a wrong kind, /// and returns `None` if the next token is not literal at all. @@ -2824,6 +2862,10 @@ impl<'a> Parser<'a> { }) } + pub(crate) fn is_builtin(&self) -> bool { + self.token.is_keyword(kw::Builtin) && self.look_ahead(1, |t| *t == token::Pound) + } + /// Parses a `try {...}` expression (`try` token already eaten). fn parse_try_block(&mut self, span_lo: Span) -> PResult<'a, P> { let (attrs, body) = self.parse_inner_attrs_and_block()?; diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 6ca88200dc51..edfe316ec954 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -265,6 +265,9 @@ impl<'a> Parser<'a> { // UNION ITEM self.bump(); // `union` self.parse_item_union()? + } else if self.is_builtin() { + // BUILTIN# ITEM + return self.parse_item_builtin(); } else if self.eat_keyword(kw::Macro) { // MACROS 2.0 ITEM self.parse_item_decl_macro(lo)? @@ -434,6 +437,11 @@ impl<'a> Parser<'a> { } } + fn parse_item_builtin(&mut self) -> PResult<'a, Option> { + // To be expanded + return Ok(None); + } + /// Parses an item macro, e.g., `item!();`. fn parse_item_macro(&mut self, vis: &Visibility) -> PResult<'a, MacCall> { let path = self.parse_path(PathStyle::Mod)?; // `foo::bar` diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 1c17de337e83..a0bd086053e4 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -90,7 +90,11 @@ impl<'a> Parser<'a> { attrs, errors::InvalidVariableDeclarationSub::UseLetNotVar, )? - } else if self.check_path() && !self.token.is_qpath_start() && !self.is_path_start_item() { + } else if self.check_path() + && !self.token.is_qpath_start() + && !self.is_path_start_item() + && !self.is_builtin() + { // We have avoided contextual keywords like `union`, items with `crate` visibility, // or `auto trait` items. We aim to parse an arbitrary path `a::b` but not something // that starts like a path (1 token), but it fact not a path. diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 58015d5d5026..9e543fc8de45 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -95,6 +95,7 @@ symbols! { // Weak keywords, have special meaning only in specific contexts. Auto: "auto", + Builtin: "builtin", Catch: "catch", Default: "default", MacroRules: "macro_rules", diff --git a/tests/ui/parser/builtin-syntax.rs b/tests/ui/parser/builtin-syntax.rs new file mode 100644 index 000000000000..c0b91a58073e --- /dev/null +++ b/tests/ui/parser/builtin-syntax.rs @@ -0,0 +1,7 @@ +fn main() { + builtin # foobar(); //~ ERROR unknown `builtin #` construct +} + +fn not_identifier() { + builtin # {}(); //~ ERROR expected identifier after +} diff --git a/tests/ui/parser/builtin-syntax.stderr b/tests/ui/parser/builtin-syntax.stderr new file mode 100644 index 000000000000..2679049fb5ef --- /dev/null +++ b/tests/ui/parser/builtin-syntax.stderr @@ -0,0 +1,14 @@ +error: unknown `builtin #` construct `foobar` + --> $DIR/builtin-syntax.rs:2:5 + | +LL | builtin # foobar(); + | ^^^^^^^^^^^^^^^^ + +error: expected identifier after `builtin #` + --> $DIR/builtin-syntax.rs:6:15 + | +LL | builtin # {}(); + | ^ + +error: aborting due to 2 previous errors + From 5eb29c7f49c2d99e9bfc778f30984f7fdcf5fc08 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 22 Apr 2023 16:29:34 +0200 Subject: [PATCH 31/97] Migrate offset_of from a macro to builtin # syntax --- .../rustc_ast_pretty/src/pprust/state/expr.rs | 3 +- compiler/rustc_builtin_macros/messages.ftl | 4 - compiler/rustc_builtin_macros/src/lib.rs | 2 - .../rustc_builtin_macros/src/offset_of.rs | 99 ------------------- compiler/rustc_parse/src/parser/expr.rs | 20 +++- compiler/rustc_span/src/symbol.rs | 1 + library/core/src/mem/mod.rs | 6 +- .../offset_of.concrete.ConstProp.diff | 16 +-- .../offset_of.generic.ConstProp.diff | 8 +- tests/ui/offset-of/offset-of-arg-count.rs | 14 ++- tests/ui/offset-of/offset-of-arg-count.stderr | 59 +++++++++-- tests/ui/offset-of/offset-of-builtin.rs | 44 +++++++++ tests/ui/offset-of/offset-of-builtin.stderr | 65 ++++++++++++ tests/ui/offset-of/offset-of-dst-field.stderr | 3 + tests/ui/offset-of/offset-of-unstable.stderr | 5 + 15 files changed, 213 insertions(+), 136 deletions(-) delete mode 100644 compiler/rustc_builtin_macros/src/offset_of.rs create mode 100644 tests/ui/offset-of/offset-of-builtin.rs create mode 100644 tests/ui/offset-of/offset-of-builtin.stderr diff --git a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs index b74c59bca30c..87c32ffce121 100644 --- a/compiler/rustc_ast_pretty/src/pprust/state/expr.rs +++ b/compiler/rustc_ast_pretty/src/pprust/state/expr.rs @@ -556,8 +556,7 @@ impl<'a> State<'a> { self.pclose(); } ast::ExprKind::OffsetOf(container, fields) => { - // FIXME: This should have its own syntax, distinct from a macro invocation. - self.word("offset_of!"); + self.word("builtin # offset_of"); self.popen(); self.rbox(0, Inconsistent); self.print_type(container); diff --git a/compiler/rustc_builtin_macros/messages.ftl b/compiler/rustc_builtin_macros/messages.ftl index 0d7cf7cdb267..3b458b1d30ba 100644 --- a/compiler/rustc_builtin_macros/messages.ftl +++ b/compiler/rustc_builtin_macros/messages.ftl @@ -150,10 +150,6 @@ builtin_macros_format_pos_mismatch = {$n} positional {$n -> *[more] arguments } in format string, but {$desc} -builtin_macros_offset_of_expected_field = expected field - -builtin_macros_offset_of_expected_two_args = expected 2 arguments - builtin_macros_test_case_non_item = `#[test_case]` attribute is only allowed on items builtin_macros_test_bad_fn = {$kind} functions cannot be used for tests diff --git a/compiler/rustc_builtin_macros/src/lib.rs b/compiler/rustc_builtin_macros/src/lib.rs index c7da61d72b38..4e5edb4d6b1d 100644 --- a/compiler/rustc_builtin_macros/src/lib.rs +++ b/compiler/rustc_builtin_macros/src/lib.rs @@ -44,7 +44,6 @@ mod format; mod format_foreign; mod global_allocator; mod log_syntax; -mod offset_of; mod source_util; mod test; mod trace_macros; @@ -92,7 +91,6 @@ pub fn register_builtin_macros(resolver: &mut dyn ResolverExpand) { line: source_util::expand_line, log_syntax: log_syntax::expand_log_syntax, module_path: source_util::expand_mod, - offset_of: offset_of::expand_offset_of, option_env: env::expand_option_env, core_panic: edition_panic::expand_panic, std_panic: edition_panic::expand_panic, diff --git a/compiler/rustc_builtin_macros/src/offset_of.rs b/compiler/rustc_builtin_macros/src/offset_of.rs deleted file mode 100644 index 0ef3e000e414..000000000000 --- a/compiler/rustc_builtin_macros/src/offset_of.rs +++ /dev/null @@ -1,99 +0,0 @@ -use rustc_ast as ast; -use rustc_ast::ptr::P; -use rustc_ast::token; -use rustc_ast::tokenstream::TokenStream; -use rustc_errors::PResult; -use rustc_expand::base::{self, *}; -use rustc_macros::Diagnostic; -use rustc_parse::parser::Parser; -use rustc_span::{symbol::Ident, Span}; - -#[derive(Diagnostic)] -#[diag(builtin_macros_offset_of_expected_field)] -struct ExpectedField { - #[primary_span] - span: Span, -} - -#[derive(Diagnostic)] -#[diag(builtin_macros_offset_of_expected_two_args)] -struct ExpectedTwoArgs { - #[primary_span] - span: Span, -} - -fn parse_field<'a>(cx: &ExtCtxt<'a>, p: &mut Parser<'a>) -> PResult<'a, Ident> { - let token = p.token.uninterpolate(); - let field = match token.kind { - token::Ident(name, _) => Ident::new(name, token.span), - token::Literal(token::Lit { kind: token::Integer, symbol, suffix: None }) => { - Ident::new(symbol, token.span) - } - _ => return Err(cx.create_err(ExpectedField { span: p.token.span })), - }; - - p.bump(); - - Ok(field) -} - -fn parse_args<'a>( - cx: &mut ExtCtxt<'a>, - sp: Span, - tts: TokenStream, -) -> PResult<'a, (P, P<[Ident]>)> { - let mut p = cx.new_parser_from_tts(tts); - - let container = p.parse_ty()?; - - p.expect(&token::Comma)?; - - if p.eat(&token::Eof) { - return Err(cx.create_err(ExpectedTwoArgs { span: sp })); - } - - let mut fields = Vec::new(); - - loop { - let field = parse_field(cx, &mut p)?; - fields.push(field); - - if p.eat(&token::Dot) { - continue; - } - - p.eat(&token::Comma); - - if !p.eat(&token::Eof) { - return Err(cx.create_err(ExpectedTwoArgs { span: sp })); - } - - break; - } - - Ok((container, fields.into())) -} - -pub fn expand_offset_of<'cx>( - cx: &'cx mut ExtCtxt<'_>, - sp: Span, - tts: TokenStream, -) -> Box { - match parse_args(cx, sp, tts) { - Ok((container, fields)) => { - let expr = P(ast::Expr { - id: ast::DUMMY_NODE_ID, - kind: ast::ExprKind::OffsetOf(container, fields), - span: sp, - attrs: ast::AttrVec::new(), - tokens: None, - }); - - MacEager::expr(expr) - } - Err(mut err) => { - err.emit(); - DummyResult::any(sp) - } - } -} diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 844cf3359628..b84a088a7b72 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1759,7 +1759,11 @@ impl<'a> Parser<'a> { /// Parse `builtin # ident(args,*)`. fn parse_expr_builtin(&mut self) -> PResult<'a, P> { - self.parse_builtin(|_this, _lo, _ident| { + self.parse_builtin(|this, lo, ident| { + if ident.name == sym::offset_of { + return Ok(Some(this.parse_expr_offset_of(lo)?)); + } + Ok(None) }) } @@ -1793,6 +1797,20 @@ impl<'a> Parser<'a> { ret } + pub(crate) fn parse_expr_offset_of(&mut self, lo: Span) -> PResult<'a, P> { + let container = self.parse_ty()?; + self.expect(&TokenKind::Comma)?; + + let seq_sep = SeqSep { sep: Some(token::Dot), trailing_sep_allowed: false }; + let (fields, _trailing, _recovered) = self.parse_seq_to_before_end( + &TokenKind::CloseDelim(Delimiter::Parenthesis), + seq_sep, + Parser::parse_field_name, + )?; + let span = lo.to(self.token.span); + Ok(self.mk_expr(span, ExprKind::OffsetOf(container, fields.to_vec().into()))) + } + /// Returns a string literal if the next token is a string literal. /// In case of error returns `Some(lit)` if the next token is a literal with a wrong kind, /// and returns `None` if the next token is not literal at all. diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 9e543fc8de45..d54a615dd4ac 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -441,6 +441,7 @@ symbols! { breakpoint, bridge, bswap, + builtin_syntax, c_str, c_str_literals, c_unwind, diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 7d2f29715236..4913a6de9182 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -1315,9 +1315,9 @@ impl SizedTypeProperties for T {} /// /// assert_eq!(mem::offset_of!(NestedA, b.0), 0); /// ``` -#[unstable(feature = "offset_of", issue = "106655")] -#[rustc_builtin_macro] #[cfg(not(bootstrap))] +#[unstable(feature = "offset_of", issue = "106655")] +#[allow_internal_unstable(builtin_syntax)] pub macro offset_of($Container:ty, $($fields:tt).+ $(,)?) { - /* compiler built-in */ + builtin # offset_of($Container, $($fields).+) } diff --git a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff index e768a47a96d1..e3757941c8cd 100644 --- a/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff +++ b/tests/mir-opt/const_prop/offset_of.concrete.ConstProp.diff @@ -22,17 +22,17 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/offset_of.rs:+1:9: +1:10 -- _1 = OffsetOf(Alpha, [0]); // scope 0 at $DIR/offset_of.rs:+1:13: +1:33 -+ _1 = const 4_usize; // scope 0 at $DIR/offset_of.rs:+1:13: +1:33 +- _1 = OffsetOf(Alpha, [0]); // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL ++ _1 = const 4_usize; // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL StorageLive(_2); // scope 1 at $DIR/offset_of.rs:+2:9: +2:10 -- _2 = OffsetOf(Alpha, [1]); // scope 1 at $DIR/offset_of.rs:+2:13: +2:33 -+ _2 = const 0_usize; // scope 1 at $DIR/offset_of.rs:+2:13: +2:33 +- _2 = OffsetOf(Alpha, [1]); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL ++ _2 = const 0_usize; // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL StorageLive(_3); // scope 2 at $DIR/offset_of.rs:+3:9: +3:11 -- _3 = OffsetOf(Alpha, [2, 0]); // scope 2 at $DIR/offset_of.rs:+3:14: +3:36 -+ _3 = const 2_usize; // scope 2 at $DIR/offset_of.rs:+3:14: +3:36 +- _3 = OffsetOf(Alpha, [2, 0]); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL ++ _3 = const 2_usize; // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL StorageLive(_4); // scope 3 at $DIR/offset_of.rs:+4:9: +4:11 -- _4 = OffsetOf(Alpha, [2, 1]); // scope 3 at $DIR/offset_of.rs:+4:14: +4:36 -+ _4 = const 3_usize; // scope 3 at $DIR/offset_of.rs:+4:14: +4:36 +- _4 = OffsetOf(Alpha, [2, 1]); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL ++ _4 = const 3_usize; // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL _0 = const (); // scope 0 at $DIR/offset_of.rs:+0:15: +5:2 StorageDead(_4); // scope 3 at $DIR/offset_of.rs:+5:1: +5:2 StorageDead(_3); // scope 2 at $DIR/offset_of.rs:+5:1: +5:2 diff --git a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff index e40fdbd79d84..4a655604cd18 100644 --- a/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff +++ b/tests/mir-opt/const_prop/offset_of.generic.ConstProp.diff @@ -22,13 +22,13 @@ bb0: { StorageLive(_1); // scope 0 at $DIR/offset_of.rs:+1:9: +1:11 - _1 = OffsetOf(Gamma, [0]); // scope 0 at $DIR/offset_of.rs:+1:14: +1:37 + _1 = OffsetOf(Gamma, [0]); // scope 0 at $SRC_DIR/core/src/mem/mod.rs:LL:COL StorageLive(_2); // scope 1 at $DIR/offset_of.rs:+2:9: +2:11 - _2 = OffsetOf(Gamma, [1]); // scope 1 at $DIR/offset_of.rs:+2:14: +2:37 + _2 = OffsetOf(Gamma, [1]); // scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL StorageLive(_3); // scope 2 at $DIR/offset_of.rs:+3:9: +3:11 - _3 = OffsetOf(Delta, [1]); // scope 2 at $DIR/offset_of.rs:+3:14: +3:37 + _3 = OffsetOf(Delta, [1]); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL StorageLive(_4); // scope 3 at $DIR/offset_of.rs:+4:9: +4:11 - _4 = OffsetOf(Delta, [2]); // scope 3 at $DIR/offset_of.rs:+4:14: +4:37 + _4 = OffsetOf(Delta, [2]); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL _0 = const (); // scope 0 at $DIR/offset_of.rs:+0:17: +5:2 StorageDead(_4); // scope 3 at $DIR/offset_of.rs:+5:1: +5:2 StorageDead(_3); // scope 2 at $DIR/offset_of.rs:+5:1: +5:2 diff --git a/tests/ui/offset-of/offset-of-arg-count.rs b/tests/ui/offset-of/offset-of-arg-count.rs index 163b07454ecd..5e66e33f8a27 100644 --- a/tests/ui/offset-of/offset-of-arg-count.rs +++ b/tests/ui/offset-of/offset-of-arg-count.rs @@ -3,7 +3,15 @@ use std::mem::offset_of; fn main() { - offset_of!(NotEnoughArguments); //~ ERROR expected one of - offset_of!(NotEnoughArgumentsWithAComma, ); //~ ERROR expected 2 arguments - offset_of!(Container, field, too many arguments); //~ ERROR expected 2 arguments + offset_of!(NotEnoughArguments); //~ ERROR unexpected end of macro invocation + offset_of!(NotEnoughArgumentsWithAComma, ); //~ ERROR unexpected end of macro invocation + offset_of!(Container, field, too many arguments); //~ ERROR no rules expected the token `too` + offset_of!(S, f); // compiles fine + offset_of!(S, f,); // also compiles fine + offset_of!(S, f.); //~ ERROR unexpected end of macro invocation + offset_of!(S, f.,); //~ ERROR expected identifier + offset_of!(S, f..); //~ ERROR no rules expected the token + offset_of!(S, f..,); //~ ERROR no rules expected the token } + +struct S { f: u8, } diff --git a/tests/ui/offset-of/offset-of-arg-count.stderr b/tests/ui/offset-of/offset-of-arg-count.stderr index ebecc982c517..4275a89545f5 100644 --- a/tests/ui/offset-of/offset-of-arg-count.stderr +++ b/tests/ui/offset-of/offset-of-arg-count.stderr @@ -1,20 +1,59 @@ -error: expected one of `!`, `(`, `+`, `,`, `::`, or `<`, found `` - --> $DIR/offset-of-arg-count.rs:6:16 +error: unexpected end of macro invocation + --> $DIR/offset-of-arg-count.rs:6:34 | LL | offset_of!(NotEnoughArguments); - | ^^^^^^^^^^^^^^^^^^ expected one of `!`, `(`, `+`, `,`, `::`, or `<` + | ^ missing tokens in macro arguments + | +note: while trying to match `,` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL -error: expected 2 arguments - --> $DIR/offset-of-arg-count.rs:7:5 +error: unexpected end of macro invocation + --> $DIR/offset-of-arg-count.rs:7:45 | LL | offset_of!(NotEnoughArgumentsWithAComma, ); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^ missing tokens in macro arguments + | +note: while trying to match meta-variable `$fields:tt` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL -error: expected 2 arguments - --> $DIR/offset-of-arg-count.rs:8:5 +error: no rules expected the token `too` + --> $DIR/offset-of-arg-count.rs:8:34 | LL | offset_of!(Container, field, too many arguments); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^ no rules expected this token in macro call + | + = note: while trying to match sequence end -error: aborting due to 3 previous errors +error: unexpected end of macro invocation + --> $DIR/offset-of-arg-count.rs:11:21 + | +LL | offset_of!(S, f.); + | ^ missing tokens in macro arguments + | +note: while trying to match meta-variable `$fields:tt` + --> $SRC_DIR/core/src/mem/mod.rs:LL:COL + +error: expected identifier, found `,` + --> $DIR/offset-of-arg-count.rs:12:21 + | +LL | offset_of!(S, f.,); + | ^ expected identifier + +error: no rules expected the token `..` + --> $DIR/offset-of-arg-count.rs:13:20 + | +LL | offset_of!(S, f..); + | ^^ no rules expected this token in macro call + | + = note: while trying to match sequence start + +error: no rules expected the token `..` + --> $DIR/offset-of-arg-count.rs:14:20 + | +LL | offset_of!(S, f..,); + | ^^ no rules expected this token in macro call + | + = note: while trying to match sequence start + +error: aborting due to 7 previous errors diff --git a/tests/ui/offset-of/offset-of-builtin.rs b/tests/ui/offset-of/offset-of-builtin.rs new file mode 100644 index 000000000000..dcc58e842a01 --- /dev/null +++ b/tests/ui/offset-of/offset-of-builtin.rs @@ -0,0 +1,44 @@ +// For the exposed macro we already test these errors in the other files, +// but this test helps to make sure the builtin construct also errors. +// This has the same examples as offset-of-arg-count.rs + + + +fn main() { + builtin # offset_of(NotEnoughArguments); //~ ERROR expected one of +} +fn t1() { + // Already errored upon at the macro level. Yielding an error would require + // extra effort. + builtin # offset_of(NotEnoughArgumentsWithAComma, ); +} +fn t2() { + builtin # offset_of(Container, field, too many arguments); //~ ERROR expected identifier, found + //~| ERROR found `,` + //~| ERROR found `many` + //~| ERROR found `arguments` +} +fn t3() { + builtin # offset_of(S, f); // compiles fine +} +fn t4() { + // Already errored upon at the macro level. Yielding an error would require + // extra effort. + builtin # offset_of(S, f); +} +fn t5() { + builtin # offset_of(S, f.); //~ ERROR expected identifier +} +fn t6() { + builtin # offset_of(S, f.,); //~ ERROR expected identifier +} +fn t7() { + builtin # offset_of(S, f..); //~ ERROR expected one of +} +fn t8() { + // Already errored upon at the macro level. Yielding an error would require + // extra effort. + builtin # offset_of(S, f..,); +} + +struct S { f: u8, } diff --git a/tests/ui/offset-of/offset-of-builtin.stderr b/tests/ui/offset-of/offset-of-builtin.stderr new file mode 100644 index 000000000000..1a1f33cc613a --- /dev/null +++ b/tests/ui/offset-of/offset-of-builtin.stderr @@ -0,0 +1,65 @@ +error: expected one of `!`, `(`, `+`, `,`, `::`, or `<`, found `)` + --> $DIR/offset-of-builtin.rs:8:43 + | +LL | builtin # offset_of(NotEnoughArguments); + | ^ expected one of `!`, `(`, `+`, `,`, `::`, or `<` + +error: expected identifier, found `,` + --> $DIR/offset-of-builtin.rs:16:41 + | +LL | builtin # offset_of(Container, field, too many arguments); + | ^ + | | + | expected identifier + | help: remove this comma + +error: expected one of `)` or `.`, found `,` + --> $DIR/offset-of-builtin.rs:16:41 + | +LL | builtin # offset_of(Container, field, too many arguments); + | ^ + | | + | expected one of `)` or `.` + | help: missing `.` + +error: expected one of `)` or `.`, found `many` + --> $DIR/offset-of-builtin.rs:16:47 + | +LL | builtin # offset_of(Container, field, too many arguments); + | -^^^^ expected one of `)` or `.` + | | + | help: missing `.` + +error: expected one of `)` or `.`, found `arguments` + --> $DIR/offset-of-builtin.rs:16:52 + | +LL | builtin # offset_of(Container, field, too many arguments); + | -^^^^^^^^^ expected one of `)` or `.` + | | + | help: missing `.` + +error: expected identifier, found `)` + --> $DIR/offset-of-builtin.rs:30:30 + | +LL | builtin # offset_of(S, f.); + | ^ expected identifier + +error: expected identifier, found `,` + --> $DIR/offset-of-builtin.rs:33:30 + | +LL | builtin # offset_of(S, f.,); + | ^ expected identifier + +error: expected one of `)` or `.`, found `..` + --> $DIR/offset-of-builtin.rs:36:29 + | +LL | builtin # offset_of(S, f..); + | ^^ expected one of `)` or `.` + | +help: if you meant to bind the contents of the rest of the array pattern into `f`, use `@` + | +LL | builtin # offset_of(S, f @ ..); + | + + +error: aborting due to 8 previous errors + diff --git a/tests/ui/offset-of/offset-of-dst-field.stderr b/tests/ui/offset-of/offset-of-dst-field.stderr index 8e88015b07a7..e6e0f4992362 100644 --- a/tests/ui/offset-of/offset-of-dst-field.stderr +++ b/tests/ui/offset-of/offset-of-dst-field.stderr @@ -5,6 +5,7 @@ LL | offset_of!(Alpha, z); | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `[u8]` + = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `(dyn Trait + 'static)` cannot be known at compilation time --> $DIR/offset-of-dst-field.rs:31:5 @@ -13,6 +14,7 @@ LL | offset_of!(Beta, z); | ^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `(dyn Trait + 'static)` + = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the size for values of type `Extern` cannot be known at compilation time --> $DIR/offset-of-dst-field.rs:32:5 @@ -21,6 +23,7 @@ LL | offset_of!(Gamma, z); | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time | = help: the trait `Sized` is not implemented for `Extern` + = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 3 previous errors diff --git a/tests/ui/offset-of/offset-of-unstable.stderr b/tests/ui/offset-of/offset-of-unstable.stderr index 25811a061d7f..c39882519a5d 100644 --- a/tests/ui/offset-of/offset-of-unstable.stderr +++ b/tests/ui/offset-of/offset-of-unstable.stderr @@ -33,6 +33,7 @@ LL | | ); | |_____^ | = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/offset-of-unstable.rs:18:5 @@ -41,6 +42,7 @@ LL | offset_of!(StableWithUnstableField, unstable); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/offset-of-unstable.rs:20:5 @@ -49,6 +51,7 @@ LL | offset_of!(StableWithUnstableFieldType, stable.unstable); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/offset-of-unstable.rs:21:5 @@ -61,6 +64,7 @@ LL | | ); | |_____^ | = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0658]: use of unstable library feature 'unstable_test_feature' --> $DIR/offset-of-unstable.rs:26:5 @@ -73,6 +77,7 @@ LL | | ); | |_____^ | = help: add `#![feature(unstable_test_feature)]` to the crate attributes to enable + = note: this error originates in the macro `offset_of` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 8 previous errors From 83b4df4e611961373ffaf4bfcd9f8940a4f37c09 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 29 Apr 2023 14:57:26 +0200 Subject: [PATCH 32/97] Add feature gate --- compiler/rustc_ast_passes/src/feature_gate.rs | 1 + compiler/rustc_feature/src/active.rs | 2 ++ compiler/rustc_parse/src/parser/expr.rs | 1 + .../ui/feature-gates/feature-gate-builtin_syntax.rs | 7 +++++++ .../feature-gates/feature-gate-builtin_syntax.stderr | 12 ++++++++++++ tests/ui/offset-of/offset-of-builtin.rs | 4 ++-- tests/ui/parser/builtin-syntax.rs | 2 ++ tests/ui/parser/builtin-syntax.stderr | 4 ++-- 8 files changed, 29 insertions(+), 4 deletions(-) create mode 100644 tests/ui/feature-gates/feature-gate-builtin_syntax.rs create mode 100644 tests/ui/feature-gates/feature-gate-builtin_syntax.stderr diff --git a/compiler/rustc_ast_passes/src/feature_gate.rs b/compiler/rustc_ast_passes/src/feature_gate.rs index b960671bf6e1..3d5056d82c56 100644 --- a/compiler/rustc_ast_passes/src/feature_gate.rs +++ b/compiler/rustc_ast_passes/src/feature_gate.rs @@ -603,6 +603,7 @@ pub fn check_crate(krate: &ast::Crate, sess: &Session) { gate_all!(yeet_expr, "`do yeet` expression is experimental"); gate_all!(dyn_star, "`dyn*` trait objects are experimental"); gate_all!(const_closures, "const closures are experimental"); + gate_all!(builtin_syntax, "`builtin #` syntax is unstable"); if !visitor.features.negative_bounds { for &span in spans.get(&sym::negative_bounds).iter().copied().flatten() { diff --git a/compiler/rustc_feature/src/active.rs b/compiler/rustc_feature/src/active.rs index 7e7df0e95843..a797dd94404c 100644 --- a/compiler/rustc_feature/src/active.rs +++ b/compiler/rustc_feature/src/active.rs @@ -313,6 +313,8 @@ declare_features! ( (active, async_closure, "1.37.0", Some(62290), None), /// Allows async functions to be declared, implemented, and used in traits. (active, async_fn_in_trait, "1.66.0", Some(91611), None), + /// Allows builtin # foo() syntax + (active, builtin_syntax, "CURRENT_RUSTC_VERSION", Some(110680), None), /// Allows `c"foo"` literals. (active, c_str_literals, "CURRENT_RUSTC_VERSION", Some(105723), None), /// Treat `extern "C"` function as nounwind. diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index b84a088a7b72..c1095512bd45 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1782,6 +1782,7 @@ impl<'a> Parser<'a> { .into_diagnostic(&self.sess.span_diagnostic); return Err(err); }; + self.sess.gated_spans.gate(sym::builtin_syntax, ident.span); self.bump(); self.expect(&TokenKind::OpenDelim(Delimiter::Parenthesis))?; diff --git a/tests/ui/feature-gates/feature-gate-builtin_syntax.rs b/tests/ui/feature-gates/feature-gate-builtin_syntax.rs new file mode 100644 index 000000000000..832bb5a96bc3 --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-builtin_syntax.rs @@ -0,0 +1,7 @@ +struct Foo { + v: u8, + w: u8, +} +fn main() { + builtin # offset_of(Foo, v); //~ ERROR `builtin #` syntax is unstable +} diff --git a/tests/ui/feature-gates/feature-gate-builtin_syntax.stderr b/tests/ui/feature-gates/feature-gate-builtin_syntax.stderr new file mode 100644 index 000000000000..3bc7848f66dd --- /dev/null +++ b/tests/ui/feature-gates/feature-gate-builtin_syntax.stderr @@ -0,0 +1,12 @@ +error[E0658]: `builtin #` syntax is unstable + --> $DIR/feature-gate-builtin_syntax.rs:6:15 + | +LL | builtin # offset_of(Foo, v); + | ^^^^^^^^^ + | + = note: see issue #110680 for more information + = help: add `#![feature(builtin_syntax)]` to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/offset-of/offset-of-builtin.rs b/tests/ui/offset-of/offset-of-builtin.rs index dcc58e842a01..1be9899887b4 100644 --- a/tests/ui/offset-of/offset-of-builtin.rs +++ b/tests/ui/offset-of/offset-of-builtin.rs @@ -1,9 +1,9 @@ +#![feature(builtin_syntax)] + // For the exposed macro we already test these errors in the other files, // but this test helps to make sure the builtin construct also errors. // This has the same examples as offset-of-arg-count.rs - - fn main() { builtin # offset_of(NotEnoughArguments); //~ ERROR expected one of } diff --git a/tests/ui/parser/builtin-syntax.rs b/tests/ui/parser/builtin-syntax.rs index c0b91a58073e..897dab8ec50a 100644 --- a/tests/ui/parser/builtin-syntax.rs +++ b/tests/ui/parser/builtin-syntax.rs @@ -1,3 +1,5 @@ +#![feature(builtin_syntax)] + fn main() { builtin # foobar(); //~ ERROR unknown `builtin #` construct } diff --git a/tests/ui/parser/builtin-syntax.stderr b/tests/ui/parser/builtin-syntax.stderr index 2679049fb5ef..ee3764a62216 100644 --- a/tests/ui/parser/builtin-syntax.stderr +++ b/tests/ui/parser/builtin-syntax.stderr @@ -1,11 +1,11 @@ error: unknown `builtin #` construct `foobar` - --> $DIR/builtin-syntax.rs:2:5 + --> $DIR/builtin-syntax.rs:4:5 | LL | builtin # foobar(); | ^^^^^^^^^^^^^^^^ error: expected identifier after `builtin #` - --> $DIR/builtin-syntax.rs:6:15 + --> $DIR/builtin-syntax.rs:8:15 | LL | builtin # {}(); | ^ From 37f3e2f4b115b166518a208950ecaaef1434830b Mon Sep 17 00:00:00 2001 From: Charisee Date: Fri, 5 May 2023 19:47:00 +0000 Subject: [PATCH 33/97] rewriting match on endianness --- compiler/rustc_codegen_ssa/src/back/metadata.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index ab805089be5f..8968133bac5b 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -123,11 +123,6 @@ fn add_gnu_property_note( Endianness::Big => v.to_be_bytes(), }) }); - /* - match endianness { - Endianness::Little => header_values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))), - Endianness::Big => header_values.map(|v| data.extend_from_slice(&(v.to_be_bytes()))), - };*/ data.extend_from_slice(b"GNU\0"); // Owner of the program property note let pr_type: u32 = match architecture { Architecture::X86_64 => 0xc0000002, @@ -138,10 +133,12 @@ fn add_gnu_property_note( let pr_data: u32 = 3; //program property descriptor let pr_padding: u32 = 0; let property_values = [pr_type, pr_datasz, pr_data, pr_padding]; - match endianness { - Endianness::Little => property_values.map(|v| data.extend_from_slice(&(v.to_le_bytes()))), - Endianness::Big => property_values.map(|v| data.extend_from_slice(&(v.to_be_bytes()))), - }; + property_values.iter().for_each(|v| { + data.extend_from_slice(&match endianness { + Endianness::Little => v.to_le_bytes(), + Endianness::Big => v.to_be_bytes(), + }) + }); file.append_section_data(section, &data, 8); } From f9b3d6a5252e043b9a0f0347e8481a61d6b83b8b Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Sat, 15 Apr 2023 11:57:07 +0100 Subject: [PATCH 34/97] Generate windows-sys bindings --- Cargo.lock | 29 +++++++++++++++++ Cargo.toml | 1 + src/bootstrap/builder.rs | 1 + src/bootstrap/run.rs | 22 +++++++++++++ src/bootstrap/tool.rs | 1 + src/tools/generate-windows-sys/Cargo.toml | 7 ++++ src/tools/generate-windows-sys/src/main.rs | 37 ++++++++++++++++++++++ 7 files changed, 98 insertions(+) create mode 100644 src/tools/generate-windows-sys/Cargo.toml create mode 100644 src/tools/generate-windows-sys/src/main.rs diff --git a/Cargo.lock b/Cargo.lock index 8e71d8ceac8d..bd5af7b409ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1443,6 +1443,13 @@ dependencies = [ "serde_json", ] +[[package]] +name = "generate-windows-sys" +version = "0.1.0" +dependencies = [ + "windows-bindgen", +] + [[package]] name = "generic-array" version = "0.14.4" @@ -5505,6 +5512,22 @@ dependencies = [ "windows-targets 0.48.0", ] +[[package]] +name = "windows-bindgen" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6935fb09b84ee57929ae92518b475f5dfdfbeb87c5334756acc28ee8e202b60" +dependencies = [ + "windows-metadata", + "windows-tokens", +] + +[[package]] +name = "windows-metadata" +version = "0.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f5bca94a32bf1e6a376522b6601275a3b611ee885ec0f1b6a05f17e8cfd3385" + [[package]] name = "windows-sys" version = "0.42.0" @@ -5568,6 +5591,12 @@ dependencies = [ "windows_x86_64_msvc 0.48.0", ] +[[package]] +name = "windows-tokens" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b34c9a3b28cb41db7385546f7f9a8179348dffc89923dde66857b1ba5312f6b4" + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" diff --git a/Cargo.toml b/Cargo.toml index 7aaa34a68e66..53331e2869f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,6 +39,7 @@ members = [ "src/tools/collect-license-metadata", "src/tools/generate-copyright", "src/tools/suggest-tests", + "src/tools/generate-windows-sys", ] exclude = [ diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index d9d4685dfc79..2cc89117ae57 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -832,6 +832,7 @@ impl<'a> Builder<'a> { run::Miri, run::CollectLicenseMetadata, run::GenerateCopyright, + run::GenerateWindowsSys, ), Kind::Setup => describe!(setup::Profile, setup::Hook, setup::Link, setup::Vscode), Kind::Clean => describe!(clean::CleanAll, clean::Rustc, clean::Std), diff --git a/src/bootstrap/run.rs b/src/bootstrap/run.rs index cb15d9a6325b..57f3119e3223 100644 --- a/src/bootstrap/run.rs +++ b/src/bootstrap/run.rs @@ -253,3 +253,25 @@ impl Step for GenerateCopyright { dest } } + +#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)] +pub struct GenerateWindowsSys; + +impl Step for GenerateWindowsSys { + type Output = (); + const ONLY_HOSTS: bool = true; + + fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { + run.path("src/tools/generate-windows-sys") + } + + fn make_run(run: RunConfig<'_>) { + run.builder.ensure(GenerateWindowsSys); + } + + fn run(self, builder: &Builder<'_>) { + let mut cmd = builder.tool_cmd(Tool::GenerateWindowsSys); + cmd.arg(&builder.src); + builder.run(&mut cmd); + } +} diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 39f6369b4d3f..f13d365e3754 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -301,6 +301,7 @@ bootstrap_tool!( CollectLicenseMetadata, "src/tools/collect-license-metadata", "collect-license-metadata"; GenerateCopyright, "src/tools/generate-copyright", "generate-copyright"; SuggestTests, "src/tools/suggest-tests", "suggest-tests"; + GenerateWindowsSys, "src/tools/generate-windows-sys", "generate-windows-sys"; ); #[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Ord, PartialOrd)] diff --git a/src/tools/generate-windows-sys/Cargo.toml b/src/tools/generate-windows-sys/Cargo.toml new file mode 100644 index 000000000000..23e88844bd0b --- /dev/null +++ b/src/tools/generate-windows-sys/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "generate-windows-sys" +version = "0.1.0" +edition = "2021" + +[dependencies.windows-bindgen] +version = "0.49" diff --git a/src/tools/generate-windows-sys/src/main.rs b/src/tools/generate-windows-sys/src/main.rs new file mode 100644 index 000000000000..0b091b1ebfa9 --- /dev/null +++ b/src/tools/generate-windows-sys/src/main.rs @@ -0,0 +1,37 @@ +use std::fs; +use std::io::{self, Write}; +use std::path::PathBuf; + +/// This is printed to the file before the rest of the contents. +const PRELUDE: &str = r#"// This file is autogenerated. +// +// To add bindings, edit windows_sys.lst then use `./x run generate-windows-sys` to +// regenerate the bindings. +// +// ignore-tidy-filelength +"#; + +fn main() -> io::Result<()> { + let mut path: PathBuf = + std::env::args_os().nth(1).expect("a path to the rust repository is required").into(); + path.push("library/std/src/sys/windows/c/windows_sys.lst"); + + // Load the list of APIs + let buffer = fs::read_to_string(&path)?; + let names: Vec<&str> = buffer + .lines() + .filter_map(|line| { + let line = line.trim(); + if line.is_empty() || line.starts_with('#') { None } else { Some(line) } + }) + .collect(); + + // Write the bindings to windows-sys.rs + let bindings = windows_bindgen::standalone_std(&names); + path.set_extension("rs"); + let mut f = std::fs::File::create(&path)?; + f.write_all(PRELUDE.as_bytes())?; + f.write_all(bindings.as_bytes())?; + + Ok(()) +} From e92ee0355969e7c34d13299d8567e384dc24e9ef Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Wed, 5 Apr 2023 02:05:37 +0100 Subject: [PATCH 35/97] Generate windows-sys bindings --- library/std/src/sys/windows/c.rs | 1301 +---- library/std/src/sys/windows/c/errors.rs | 1883 -------- library/std/src/sys/windows/c/windows_sys.lst | 2587 ++++++++++ library/std/src/sys/windows/c/windows_sys.rs | 4276 +++++++++++++++++ 4 files changed, 7009 insertions(+), 3038 deletions(-) delete mode 100644 library/std/src/sys/windows/c/errors.rs create mode 100644 library/std/src/sys/windows/c/windows_sys.lst create mode 100644 library/std/src/sys/windows/c/windows_sys.rs diff --git a/library/std/src/sys/windows/c.rs b/library/std/src/sys/windows/c.rs index 1f4092ad7384..2bc40c4748a3 100644 --- a/library/std/src/sys/windows/c.rs +++ b/library/std/src/sys/windows/c.rs @@ -6,33 +6,18 @@ use crate::ffi::CStr; use crate::mem; -use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort}; -use crate::os::windows::io::{BorrowedHandle, HandleOrInvalid, HandleOrNull}; +pub use crate::os::raw::c_int; +use crate::os::raw::{c_char, c_long, c_longlong, c_uint, c_ulong, c_ushort, c_void}; +use crate::os::windows::io::{AsRawHandle, BorrowedHandle}; use crate::ptr; use core::ffi::NonZero_c_ulong; -use libc::{c_void, size_t, wchar_t}; +#[path = "c/windows_sys.rs"] // c.rs is included from two places so we need to specify this +mod windows_sys; +pub use windows_sys::*; -pub use crate::os::raw::c_int; - -#[path = "c/errors.rs"] // c.rs is included from two places so we need to specify this -mod errors; -pub use errors::*; - -pub use self::EXCEPTION_DISPOSITION::*; -pub use self::FILE_INFO_BY_HANDLE_CLASS::*; - -pub type DWORD_PTR = ULONG_PTR; pub type DWORD = c_ulong; pub type NonZeroDWORD = NonZero_c_ulong; -pub type HANDLE = LPVOID; -pub type HINSTANCE = HANDLE; -pub type HMODULE = HINSTANCE; -pub type HRESULT = LONG; -pub type BOOL = c_int; -pub type BYTE = u8; -pub type BOOLEAN = BYTE; -pub type GROUP = c_uint; pub type LARGE_INTEGER = c_longlong; pub type LONG = c_long; pub type UINT = c_uint; @@ -41,218 +26,40 @@ pub type USHORT = c_ushort; pub type SIZE_T = usize; pub type WORD = u16; pub type CHAR = c_char; -pub type CCHAR = c_char; -pub type ULONG_PTR = usize; pub type ULONG = c_ulong; -pub type NTSTATUS = LONG; pub type ACCESS_MASK = DWORD; -pub type LPBOOL = *mut BOOL; -pub type LPBYTE = *mut BYTE; -pub type LPCCH = *const CHAR; -pub type LPCSTR = *const CHAR; -pub type LPCWCH = *const WCHAR; -pub type LPCWSTR = *const WCHAR; pub type LPCVOID = *const c_void; -pub type LPDWORD = *mut DWORD; pub type LPHANDLE = *mut HANDLE; pub type LPOVERLAPPED = *mut OVERLAPPED; -pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION; pub type LPSECURITY_ATTRIBUTES = *mut SECURITY_ATTRIBUTES; -pub type LPSTARTUPINFO = *mut STARTUPINFO; -pub type LPSTR = *mut CHAR; pub type LPVOID = *mut c_void; pub type LPWCH = *mut WCHAR; -pub type LPWIN32_FIND_DATAW = *mut WIN32_FIND_DATAW; -pub type LPWSADATA = *mut WSADATA; -pub type LPWSAPROTOCOL_INFO = *mut WSAPROTOCOL_INFO; pub type LPWSTR = *mut WCHAR; -pub type LPFILETIME = *mut FILETIME; -pub type LPSYSTEM_INFO = *mut SYSTEM_INFO; -pub type LPWSABUF = *mut WSABUF; -pub type LPWSAOVERLAPPED = *mut c_void; -pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = *mut c_void; -pub type BCRYPT_ALG_HANDLE = LPVOID; -pub type PCONDITION_VARIABLE = *mut CONDITION_VARIABLE; pub type PLARGE_INTEGER = *mut c_longlong; pub type PSRWLOCK = *mut SRWLOCK; -pub type LPINIT_ONCE = *mut INIT_ONCE; -pub type SOCKET = crate::os::windows::raw::SOCKET; pub type socklen_t = c_int; pub type ADDRESS_FAMILY = USHORT; +pub use FD_SET as fd_set; +pub use LINGER as linger; +pub use TIMEVAL as timeval; -pub const TRUE: BOOL = 1; -pub const FALSE: BOOL = 0; +pub type CONDITION_VARIABLE = RTL_CONDITION_VARIABLE; +pub type SRWLOCK = RTL_SRWLOCK; +pub type INIT_ONCE = RTL_RUN_ONCE; -pub const CSTR_LESS_THAN: c_int = 1; -pub const CSTR_EQUAL: c_int = 2; -pub const CSTR_GREATER_THAN: c_int = 3; +pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { Ptr: ptr::null_mut() }; +pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { Ptr: ptr::null_mut() }; +pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { Ptr: ptr::null_mut() }; -pub const FILE_ATTRIBUTE_READONLY: DWORD = 0x1; -pub const FILE_ATTRIBUTE_DIRECTORY: DWORD = 0x10; -pub const FILE_ATTRIBUTE_REPARSE_POINT: DWORD = 0x400; -pub const INVALID_FILE_ATTRIBUTES: DWORD = DWORD::MAX; - -pub const FILE_SHARE_DELETE: DWORD = 0x4; -pub const FILE_SHARE_READ: DWORD = 0x1; -pub const FILE_SHARE_WRITE: DWORD = 0x2; - -pub const FILE_OPEN: ULONG = 0x00000001; -pub const FILE_OPEN_REPARSE_POINT: ULONG = 0x200000; -pub const OBJ_DONT_REPARSE: ULONG = 0x1000; - -pub const CREATE_ALWAYS: DWORD = 2; -pub const CREATE_NEW: DWORD = 1; -pub const OPEN_ALWAYS: DWORD = 4; -pub const OPEN_EXISTING: DWORD = 3; -pub const TRUNCATE_EXISTING: DWORD = 5; - -pub const FILE_LIST_DIRECTORY: DWORD = 0x1; -pub const FILE_WRITE_DATA: DWORD = 0x00000002; -pub const FILE_APPEND_DATA: DWORD = 0x00000004; -pub const FILE_WRITE_EA: DWORD = 0x00000010; -pub const FILE_WRITE_ATTRIBUTES: DWORD = 0x00000100; -pub const DELETE: DWORD = 0x10000; -pub const READ_CONTROL: DWORD = 0x00020000; -pub const SYNCHRONIZE: DWORD = 0x00100000; -pub const GENERIC_READ: DWORD = 0x80000000; -pub const GENERIC_WRITE: DWORD = 0x40000000; -pub const STANDARD_RIGHTS_WRITE: DWORD = READ_CONTROL; -pub const FILE_GENERIC_WRITE: DWORD = STANDARD_RIGHTS_WRITE - | FILE_WRITE_DATA - | FILE_WRITE_ATTRIBUTES - | FILE_WRITE_EA - | FILE_APPEND_DATA - | SYNCHRONIZE; - -pub const FILE_FLAG_OPEN_REPARSE_POINT: DWORD = 0x00200000; -pub const FILE_FLAG_BACKUP_SEMANTICS: DWORD = 0x02000000; -pub const SECURITY_SQOS_PRESENT: DWORD = 0x00100000; - -pub const FIONBIO: c_ulong = 0x8004667e; - -pub const MAX_PATH: usize = 260; - -pub const FILE_TYPE_PIPE: u32 = 3; - -pub const CP_UTF8: DWORD = 65001; -pub const MB_ERR_INVALID_CHARS: DWORD = 0x08; -pub const WC_ERR_INVALID_CHARS: DWORD = 0x80; - -#[repr(C)] -#[derive(Copy)] -pub struct WIN32_FIND_DATAW { - pub dwFileAttributes: DWORD, - pub ftCreationTime: FILETIME, - pub ftLastAccessTime: FILETIME, - pub ftLastWriteTime: FILETIME, - pub nFileSizeHigh: DWORD, - pub nFileSizeLow: DWORD, - pub dwReserved0: DWORD, - pub dwReserved1: DWORD, - pub cFileName: [wchar_t; 260], // #define MAX_PATH 260 - pub cAlternateFileName: [wchar_t; 14], -} -impl Clone for WIN32_FIND_DATAW { - fn clone(&self) -> Self { - *self - } -} - -pub const WSA_FLAG_OVERLAPPED: DWORD = 0x01; -pub const WSA_FLAG_NO_HANDLE_INHERIT: DWORD = 0x80; - -pub const WSADESCRIPTION_LEN: usize = 256; -pub const WSASYS_STATUS_LEN: usize = 128; -pub const WSAPROTOCOL_LEN: DWORD = 255; -pub const INVALID_SOCKET: SOCKET = !0; - -pub const MAX_PROTOCOL_CHAIN: DWORD = 7; - -pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: usize = 16 * 1024; -pub const FSCTL_GET_REPARSE_POINT: DWORD = 0x900a8; -pub const IO_REPARSE_TAG_SYMLINK: DWORD = 0xa000000c; -pub const IO_REPARSE_TAG_MOUNT_POINT: DWORD = 0xa0000003; -pub const SYMLINK_FLAG_RELATIVE: DWORD = 0x00000001; -pub const FSCTL_SET_REPARSE_POINT: DWORD = 0x900a4; - -pub const SYMBOLIC_LINK_FLAG_DIRECTORY: DWORD = 0x1; -pub const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: DWORD = 0x2; - -// Note that these are not actually HANDLEs, just values to pass to GetStdHandle -pub const STD_INPUT_HANDLE: DWORD = -10i32 as DWORD; -pub const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; -pub const STD_ERROR_HANDLE: DWORD = -12i32 as DWORD; - -pub const PROGRESS_CONTINUE: DWORD = 0; - -pub const E_NOTIMPL: HRESULT = 0x80004001u32 as HRESULT; - -pub const INVALID_HANDLE_VALUE: HANDLE = ptr::invalid_mut(!0); - -pub const FACILITY_NT_BIT: DWORD = 0x1000_0000; - -pub const FORMAT_MESSAGE_FROM_SYSTEM: DWORD = 0x00001000; -pub const FORMAT_MESSAGE_FROM_HMODULE: DWORD = 0x00000800; -pub const FORMAT_MESSAGE_IGNORE_INSERTS: DWORD = 0x00000200; - -pub const TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF; - -pub const DLL_THREAD_DETACH: DWORD = 3; -pub const DLL_PROCESS_DETACH: DWORD = 0; - -pub const INFINITE: DWORD = !0; - -pub const DUPLICATE_SAME_ACCESS: DWORD = 0x00000002; - -pub const CONDITION_VARIABLE_INIT: CONDITION_VARIABLE = CONDITION_VARIABLE { ptr: ptr::null_mut() }; -pub const SRWLOCK_INIT: SRWLOCK = SRWLOCK { ptr: ptr::null_mut() }; -pub const INIT_ONCE_STATIC_INIT: INIT_ONCE = INIT_ONCE { ptr: ptr::null_mut() }; - -pub const INIT_ONCE_INIT_FAILED: DWORD = 0x00000004; - -pub const DETACHED_PROCESS: DWORD = 0x00000008; -pub const CREATE_NEW_PROCESS_GROUP: DWORD = 0x00000200; -pub const CREATE_UNICODE_ENVIRONMENT: DWORD = 0x00000400; -pub const STARTF_USESTDHANDLES: DWORD = 0x00000100; - -pub const AF_INET: c_int = 2; -pub const AF_INET6: c_int = 23; -pub const SD_BOTH: c_int = 2; -pub const SD_RECEIVE: c_int = 0; -pub const SD_SEND: c_int = 1; -pub const SOCK_DGRAM: c_int = 2; -pub const SOCK_STREAM: c_int = 1; -pub const SOCKET_ERROR: c_int = -1; -pub const SOL_SOCKET: c_int = 0xffff; -pub const SO_LINGER: c_int = 0x0080; -pub const SO_RCVTIMEO: c_int = 0x1006; -pub const SO_SNDTIMEO: c_int = 0x1005; -pub const IPPROTO_IP: c_int = 0; -pub const IPPROTO_TCP: c_int = 6; -pub const IPPROTO_IPV6: c_int = 41; -pub const TCP_NODELAY: c_int = 0x0001; -pub const IP_TTL: c_int = 4; -pub const IPV6_V6ONLY: c_int = 27; -pub const SO_ERROR: c_int = 0x1007; -pub const SO_BROADCAST: c_int = 0x0020; -pub const IP_MULTICAST_LOOP: c_int = 11; -pub const IPV6_MULTICAST_LOOP: c_int = 11; -pub const IP_MULTICAST_TTL: c_int = 10; -pub const IP_ADD_MEMBERSHIP: c_int = 12; -pub const IP_DROP_MEMBERSHIP: c_int = 13; -pub const IPV6_ADD_MEMBERSHIP: c_int = 12; -pub const IPV6_DROP_MEMBERSHIP: c_int = 13; -pub const MSG_PEEK: c_int = 0x2; - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct linger { - pub l_onoff: c_ushort, - pub l_linger: c_ushort, -} +// Some windows_sys types have different signs than the types we use. +pub const OBJ_DONT_REPARSE: u32 = windows_sys::OBJ_DONT_REPARSE as u32; +pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: u32 = + windows_sys::FRS_ERR_SYSVOL_POPULATE_TIMEOUT as u32; +pub const AF_INET: c_int = windows_sys::AF_INET as c_int; +pub const AF_INET6: c_int = windows_sys::AF_INET6 as c_int; #[repr(C)] pub struct ip_mreq { @@ -266,66 +73,19 @@ pub struct ipv6_mreq { pub ipv6mr_interface: c_uint, } -pub const VOLUME_NAME_DOS: DWORD = 0x0; -pub const MOVEFILE_REPLACE_EXISTING: DWORD = 1; - -pub const FILE_BEGIN: DWORD = 0; -pub const FILE_CURRENT: DWORD = 1; -pub const FILE_END: DWORD = 2; - -pub const WAIT_OBJECT_0: DWORD = 0x00000000; -pub const WAIT_TIMEOUT: DWORD = 258; -pub const WAIT_FAILED: DWORD = 0xFFFFFFFF; - -pub const PIPE_ACCESS_INBOUND: DWORD = 0x00000001; -pub const PIPE_ACCESS_OUTBOUND: DWORD = 0x00000002; -pub const FILE_FLAG_FIRST_PIPE_INSTANCE: DWORD = 0x00080000; -pub const FILE_FLAG_OVERLAPPED: DWORD = 0x40000000; -pub const PIPE_WAIT: DWORD = 0x00000000; -pub const PIPE_TYPE_BYTE: DWORD = 0x00000000; -pub const PIPE_REJECT_REMOTE_CLIENTS: DWORD = 0x00000008; -pub const PIPE_READMODE_BYTE: DWORD = 0x00000000; - -pub const FD_SETSIZE: usize = 64; - -pub const STACK_SIZE_PARAM_IS_A_RESERVATION: DWORD = 0x00010000; - -pub const STATUS_SUCCESS: NTSTATUS = 0x00000000; -pub const STATUS_DELETE_PENDING: NTSTATUS = 0xc0000056_u32 as _; -pub const STATUS_INVALID_PARAMETER: NTSTATUS = 0xc000000d_u32 as _; - -pub const STATUS_PENDING: NTSTATUS = 0x103 as _; -pub const STATUS_END_OF_FILE: NTSTATUS = 0xC0000011_u32 as _; - // Equivalent to the `NT_SUCCESS` C preprocessor macro. // See: https://docs.microsoft.com/en-us/windows-hardware/drivers/kernel/using-ntstatus-values pub fn nt_success(status: NTSTATUS) -> bool { status >= 0 } -pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: DWORD = 0x00000002; - -#[repr(C)] -pub struct UNICODE_STRING { - pub Length: u16, - pub MaximumLength: u16, - pub Buffer: *mut u16, -} impl UNICODE_STRING { pub fn from_ref(slice: &[u16]) -> Self { let len = slice.len() * mem::size_of::(); Self { Length: len as _, MaximumLength: len as _, Buffer: slice.as_ptr() as _ } } } -#[repr(C)] -pub struct OBJECT_ATTRIBUTES { - pub Length: ULONG, - pub RootDirectory: HANDLE, - pub ObjectName: *const UNICODE_STRING, - pub Attributes: ULONG, - pub SecurityDescriptor: *mut c_void, - pub SecurityQualityOfService: *mut c_void, -} + impl Default for OBJECT_ATTRIBUTES { fn default() -> Self { Self { @@ -338,193 +98,20 @@ impl Default for OBJECT_ATTRIBUTES { } } } -#[repr(C)] -union IO_STATUS_BLOCK_union { - Status: NTSTATUS, - Pointer: *mut c_void, -} -impl Default for IO_STATUS_BLOCK_union { - fn default() -> Self { - let mut this = Self { Pointer: ptr::null_mut() }; - this.Status = STATUS_PENDING; - this - } -} -#[repr(C)] -#[derive(Default)] -pub struct IO_STATUS_BLOCK { - u: IO_STATUS_BLOCK_union, - pub Information: usize, -} + impl IO_STATUS_BLOCK { + pub const PENDING: Self = + IO_STATUS_BLOCK { Anonymous: IO_STATUS_BLOCK_0 { Status: STATUS_PENDING }, Information: 0 }; pub fn status(&self) -> NTSTATUS { - // SAFETY: If `self.u.Status` was set then this is obviously safe. - // If `self.u.Pointer` was set then this is the equivalent to converting + // SAFETY: If `self.Anonymous.Status` was set then this is obviously safe. + // If `self.Anonymous.Pointer` was set then this is the equivalent to converting // the pointer to an integer, which is also safe. // Currently the only safe way to construct `IO_STATUS_BLOCK` outside of // this module is to call the `default` method, which sets the `Status`. - unsafe { self.u.Status } + unsafe { self.Anonymous.Status } } } -pub type LPOVERLAPPED_COMPLETION_ROUTINE = unsafe extern "system" fn( - dwErrorCode: DWORD, - dwNumberOfBytesTransferred: DWORD, - lpOverlapped: *mut OVERLAPPED, -); - -type IO_APC_ROUTINE = unsafe extern "system" fn( - ApcContext: *mut c_void, - IoStatusBlock: *mut IO_STATUS_BLOCK, - Reserved: ULONG, -); - -#[repr(C)] -#[cfg(not(target_pointer_width = "64"))] -pub struct WSADATA { - pub wVersion: WORD, - pub wHighVersion: WORD, - pub szDescription: [u8; WSADESCRIPTION_LEN + 1], - pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1], - pub iMaxSockets: u16, - pub iMaxUdpDg: u16, - pub lpVendorInfo: *mut u8, -} -#[repr(C)] -#[cfg(target_pointer_width = "64")] -pub struct WSADATA { - pub wVersion: WORD, - pub wHighVersion: WORD, - pub iMaxSockets: u16, - pub iMaxUdpDg: u16, - pub lpVendorInfo: *mut u8, - pub szDescription: [u8; WSADESCRIPTION_LEN + 1], - pub szSystemStatus: [u8; WSASYS_STATUS_LEN + 1], -} - -#[derive(Copy, Clone)] -#[repr(C)] -pub struct WSABUF { - pub len: ULONG, - pub buf: *mut CHAR, -} - -#[repr(C)] -pub struct WSAPROTOCOL_INFO { - pub dwServiceFlags1: DWORD, - pub dwServiceFlags2: DWORD, - pub dwServiceFlags3: DWORD, - pub dwServiceFlags4: DWORD, - pub dwProviderFlags: DWORD, - pub ProviderId: GUID, - pub dwCatalogEntryId: DWORD, - pub ProtocolChain: WSAPROTOCOLCHAIN, - pub iVersion: c_int, - pub iAddressFamily: c_int, - pub iMaxSockAddr: c_int, - pub iMinSockAddr: c_int, - pub iSocketType: c_int, - pub iProtocol: c_int, - pub iProtocolMaxOffset: c_int, - pub iNetworkByteOrder: c_int, - pub iSecurityScheme: c_int, - pub dwMessageSize: DWORD, - pub dwProviderReserved: DWORD, - pub szProtocol: [u16; (WSAPROTOCOL_LEN as usize) + 1], -} - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct WIN32_FILE_ATTRIBUTE_DATA { - pub dwFileAttributes: DWORD, - pub ftCreationTime: FILETIME, - pub ftLastAccessTime: FILETIME, - pub ftLastWriteTime: FILETIME, - pub nFileSizeHigh: DWORD, - pub nFileSizeLow: DWORD, -} - -#[repr(C)] -#[allow(dead_code)] // we only use some variants -pub enum FILE_INFO_BY_HANDLE_CLASS { - FileBasicInfo = 0, - FileStandardInfo = 1, - FileNameInfo = 2, - FileRenameInfo = 3, - FileDispositionInfo = 4, - FileAllocationInfo = 5, - FileEndOfFileInfo = 6, - FileStreamInfo = 7, - FileCompressionInfo = 8, - FileAttributeTagInfo = 9, - FileIdBothDirectoryInfo = 10, // 0xA - FileIdBothDirectoryRestartInfo = 11, // 0xB - FileIoPriorityHintInfo = 12, // 0xC - FileRemoteProtocolInfo = 13, // 0xD - FileFullDirectoryInfo = 14, // 0xE - FileFullDirectoryRestartInfo = 15, // 0xF - FileStorageInfo = 16, // 0x10 - FileAlignmentInfo = 17, // 0x11 - FileIdInfo = 18, // 0x12 - FileIdExtdDirectoryInfo = 19, // 0x13 - FileIdExtdDirectoryRestartInfo = 20, // 0x14 - FileDispositionInfoEx = 21, // 0x15, Windows 10 version 1607 - MaximumFileInfoByHandlesClass, -} - -#[repr(C)] -pub struct FILE_ATTRIBUTE_TAG_INFO { - pub FileAttributes: DWORD, - pub ReparseTag: DWORD, -} - -#[repr(C)] -pub struct FILE_DISPOSITION_INFO { - pub DeleteFile: BOOLEAN, -} - -pub const FILE_DISPOSITION_DELETE: DWORD = 0x1; -pub const FILE_DISPOSITION_POSIX_SEMANTICS: DWORD = 0x2; -pub const FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE: DWORD = 0x10; - -#[repr(C)] -pub struct FILE_DISPOSITION_INFO_EX { - pub Flags: DWORD, -} - -#[repr(C)] -#[derive(Default)] -pub struct FILE_ID_BOTH_DIR_INFO { - pub NextEntryOffset: DWORD, - pub FileIndex: DWORD, - pub CreationTime: LARGE_INTEGER, - pub LastAccessTime: LARGE_INTEGER, - pub LastWriteTime: LARGE_INTEGER, - pub ChangeTime: LARGE_INTEGER, - pub EndOfFile: LARGE_INTEGER, - pub AllocationSize: LARGE_INTEGER, - pub FileAttributes: DWORD, - pub FileNameLength: DWORD, - pub EaSize: DWORD, - pub ShortNameLength: CCHAR, - pub ShortName: [WCHAR; 12], - pub FileId: LARGE_INTEGER, - pub FileName: [WCHAR; 1], -} -#[repr(C)] -pub struct FILE_BASIC_INFO { - pub CreationTime: LARGE_INTEGER, - pub LastAccessTime: LARGE_INTEGER, - pub LastWriteTime: LARGE_INTEGER, - pub ChangeTime: LARGE_INTEGER, - pub FileAttributes: DWORD, -} - -#[repr(C)] -pub struct FILE_END_OF_FILE_INFO { - pub EndOfFile: LARGE_INTEGER, -} - /// NB: Use carefully! In general using this as a reference is likely to get the /// provenance wrong for the `rest` field! #[repr(C)] @@ -555,34 +142,6 @@ pub struct MOUNT_POINT_REPARSE_BUFFER { pub PrintNameLength: c_ushort, pub PathBuffer: WCHAR, } - -pub type LPPROGRESS_ROUTINE = crate::option::Option< - unsafe extern "system" fn( - TotalFileSize: LARGE_INTEGER, - TotalBytesTransferred: LARGE_INTEGER, - StreamSize: LARGE_INTEGER, - StreamBytesTransferred: LARGE_INTEGER, - dwStreamNumber: DWORD, - dwCallbackReason: DWORD, - hSourceFile: HANDLE, - hDestinationFile: HANDLE, - lpData: LPVOID, - ) -> DWORD, ->; - -#[repr(C)] -pub struct CONDITION_VARIABLE { - pub ptr: LPVOID, -} -#[repr(C)] -pub struct SRWLOCK { - pub ptr: LPVOID, -} -#[repr(C)] -pub struct INIT_ONCE { - pub ptr: LPVOID, -} - #[repr(C)] pub struct REPARSE_MOUNTPOINT_DATA_BUFFER { pub ReparseTag: DWORD, @@ -594,103 +153,6 @@ pub struct REPARSE_MOUNTPOINT_DATA_BUFFER { pub ReparseTarget: WCHAR, } -#[repr(C)] -pub struct GUID { - pub Data1: DWORD, - pub Data2: WORD, - pub Data3: WORD, - pub Data4: [BYTE; 8], -} - -#[repr(C)] -pub struct WSAPROTOCOLCHAIN { - pub ChainLen: c_int, - pub ChainEntries: [DWORD; MAX_PROTOCOL_CHAIN as usize], -} - -#[repr(C)] -pub struct SECURITY_ATTRIBUTES { - pub nLength: DWORD, - pub lpSecurityDescriptor: LPVOID, - pub bInheritHandle: BOOL, -} - -#[repr(C)] -pub struct PROCESS_INFORMATION { - pub hProcess: HANDLE, - pub hThread: HANDLE, - pub dwProcessId: DWORD, - pub dwThreadId: DWORD, -} - -#[repr(C)] -pub struct STARTUPINFO { - pub cb: DWORD, - pub lpReserved: LPWSTR, - pub lpDesktop: LPWSTR, - pub lpTitle: LPWSTR, - pub dwX: DWORD, - pub dwY: DWORD, - pub dwXSize: DWORD, - pub dwYSize: DWORD, - pub dwXCountChars: DWORD, - pub dwYCountCharts: DWORD, - pub dwFillAttribute: DWORD, - pub dwFlags: DWORD, - pub wShowWindow: WORD, - pub cbReserved2: WORD, - pub lpReserved2: LPBYTE, - pub hStdInput: HANDLE, - pub hStdOutput: HANDLE, - pub hStdError: HANDLE, -} - -#[repr(C)] -pub struct SOCKADDR { - pub sa_family: ADDRESS_FAMILY, - pub sa_data: [CHAR; 14], -} - -#[repr(C)] -#[derive(Copy, Clone, Debug, Default)] -pub struct FILETIME { - pub dwLowDateTime: DWORD, - pub dwHighDateTime: DWORD, -} - -#[repr(C)] -pub struct SYSTEM_INFO { - pub wProcessorArchitecture: WORD, - pub wReserved: WORD, - pub dwPageSize: DWORD, - pub lpMinimumApplicationAddress: LPVOID, - pub lpMaximumApplicationAddress: LPVOID, - pub dwActiveProcessorMask: DWORD_PTR, - pub dwNumberOfProcessors: DWORD, - pub dwProcessorType: DWORD, - pub dwAllocationGranularity: DWORD, - pub wProcessorLevel: WORD, - pub wProcessorRevision: WORD, -} - -#[repr(C)] -pub struct OVERLAPPED { - pub Internal: *mut c_ulong, - pub InternalHigh: *mut c_ulong, - pub Offset: DWORD, - pub OffsetHigh: DWORD, - pub hEvent: HANDLE, -} - -#[repr(C)] -#[allow(dead_code)] // we only use some variants -pub enum ADDRESS_MODE { - AddrMode1616, - AddrMode1632, - AddrModeReal, - AddrModeFlat, -} - #[repr(C)] pub struct SOCKADDR_STORAGE_LH { pub ss_family: ADDRESS_FAMILY, @@ -699,18 +161,6 @@ pub struct SOCKADDR_STORAGE_LH { pub __ss_pad2: [CHAR; 112], } -#[repr(C)] -pub struct ADDRINFOA { - pub ai_flags: c_int, - pub ai_family: c_int, - pub ai_socktype: c_int, - pub ai_protocol: c_int, - pub ai_addrlen: size_t, - pub ai_canonname: *mut c_char, - pub ai_addr: *mut SOCKADDR, - pub ai_next: *mut ADDRINFOA, -} - #[repr(C)] #[derive(Copy, Clone)] pub struct sockaddr_in { @@ -742,583 +192,126 @@ pub struct in6_addr { pub s6_addr: [u8; 16], } -#[repr(C)] -#[derive(Copy, Clone)] -#[allow(dead_code)] // we only use some variants -pub enum EXCEPTION_DISPOSITION { - ExceptionContinueExecution, - ExceptionContinueSearch, - ExceptionNestedException, - ExceptionCollidedUnwind, -} - -#[repr(C)] -#[derive(Copy)] -pub struct fd_set { - pub fd_count: c_uint, - pub fd_array: [SOCKET; FD_SETSIZE], -} - -impl Clone for fd_set { - fn clone(&self) -> fd_set { - *self - } -} - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct timeval { - pub tv_sec: c_long, - pub tv_usec: c_long, -} - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct CONSOLE_READCONSOLE_CONTROL { - pub nLength: ULONG, - pub nInitialChars: ULONG, - pub dwCtrlWakeupMask: ULONG, - pub dwControlKeyState: ULONG, -} -pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL; - // Desktop specific functions & types cfg_if::cfg_if! { if #[cfg(not(target_vendor = "uwp"))] { - pub const EXCEPTION_CONTINUE_SEARCH: LONG = 0; - pub const EXCEPTION_STACK_OVERFLOW: DWORD = 0xc00000fd; - pub const EXCEPTION_MAXIMUM_PARAMETERS: usize = 15; - - #[repr(C)] - pub struct EXCEPTION_RECORD { - pub ExceptionCode: DWORD, - pub ExceptionFlags: DWORD, - pub ExceptionRecord: *mut EXCEPTION_RECORD, - pub ExceptionAddress: LPVOID, - pub NumberParameters: DWORD, - pub ExceptionInformation: [LPVOID; EXCEPTION_MAXIMUM_PARAMETERS], - } - - pub enum CONTEXT {} - - #[repr(C)] - pub struct EXCEPTION_POINTERS { - pub ExceptionRecord: *mut EXCEPTION_RECORD, - pub ContextRecord: *mut CONTEXT, - } - - pub type PVECTORED_EXCEPTION_HANDLER = - extern "system" fn(ExceptionInfo: *mut EXCEPTION_POINTERS) -> LONG; - - #[repr(C)] - pub struct BY_HANDLE_FILE_INFORMATION { - pub dwFileAttributes: DWORD, - pub ftCreationTime: FILETIME, - pub ftLastAccessTime: FILETIME, - pub ftLastWriteTime: FILETIME, - pub dwVolumeSerialNumber: DWORD, - pub nFileSizeHigh: DWORD, - pub nFileSizeLow: DWORD, - pub nNumberOfLinks: DWORD, - pub nFileIndexHigh: DWORD, - pub nFileIndexLow: DWORD, - } - - pub type LPBY_HANDLE_FILE_INFORMATION = *mut BY_HANDLE_FILE_INFORMATION; - - pub const HANDLE_FLAG_INHERIT: DWORD = 0x00000001; - - pub const TOKEN_READ: DWORD = 0x20008; - - #[link(name = "advapi32")] - extern "system" { - // Forbidden when targeting UWP - #[link_name = "SystemFunction036"] - pub fn RtlGenRandom(RandomBuffer: *mut u8, RandomBufferLength: ULONG) -> BOOLEAN; - - // Allowed but unused by UWP - pub fn OpenProcessToken( - ProcessHandle: HANDLE, - DesiredAccess: DWORD, - TokenHandle: *mut HANDLE, - ) -> BOOL; - } - - #[link(name = "userenv")] - extern "system" { - // Allowed but unused by UWP - pub fn GetUserProfileDirectoryW( - hToken: HANDLE, - lpProfileDir: LPWSTR, - lpcchSize: *mut DWORD, - ) -> BOOL; - } - - #[link(name = "kernel32")] - extern "system" { - // Allowed but unused by UWP - pub fn GetFileInformationByHandle( - hFile: HANDLE, - lpFileInformation: LPBY_HANDLE_FILE_INFORMATION, - ) -> BOOL; - pub fn SetHandleInformation(hObject: HANDLE, dwMask: DWORD, dwFlags: DWORD) -> BOOL; - pub fn AddVectoredExceptionHandler( - FirstHandler: ULONG, - VectoredHandler: PVECTORED_EXCEPTION_HANDLER, - ) -> LPVOID; - pub fn CreateHardLinkW( - lpSymlinkFileName: LPCWSTR, - lpTargetFileName: LPCWSTR, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> BOOL; - pub fn SetThreadStackGuarantee(_size: *mut c_ulong) -> BOOL; - pub fn GetWindowsDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; - } + pub const EXCEPTION_CONTINUE_SEARCH: i32 = 0; } } -// UWP specific functions & types -cfg_if::cfg_if! { -if #[cfg(target_vendor = "uwp")] { - #[repr(C)] - pub struct FILE_STANDARD_INFO { - pub AllocationSize: LARGE_INTEGER, - pub EndOfFile: LARGE_INTEGER, - pub NumberOfLinks: DWORD, - pub DeletePending: BOOLEAN, - pub Directory: BOOLEAN, - } -} +pub unsafe extern "system" fn WriteFileEx( + hFile: BorrowedHandle<'_>, + lpBuffer: *mut ::core::ffi::c_void, + nNumberOfBytesToWrite: u32, + lpOverlapped: *mut OVERLAPPED, + lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, +) -> BOOL { + windows_sys::WriteFileEx( + hFile.as_raw_handle(), + lpBuffer.cast::(), + nNumberOfBytesToWrite, + lpOverlapped, + lpCompletionRoutine, + ) } -// Shared between Desktop & UWP - -#[link(name = "kernel32")] -extern "system" { - pub fn GetCurrentProcessId() -> DWORD; - - pub fn ReadConsoleW( - hConsoleInput: HANDLE, - lpBuffer: LPVOID, - nNumberOfCharsToRead: DWORD, - lpNumberOfCharsRead: LPDWORD, - pInputControl: PCONSOLE_READCONSOLE_CONTROL, - ) -> BOOL; - pub fn WriteConsoleW( - hConsoleOutput: HANDLE, - lpBuffer: LPCVOID, - nNumberOfCharsToWrite: DWORD, - lpNumberOfCharsWritten: LPDWORD, - lpReserved: LPVOID, - ) -> BOOL; - pub fn GetConsoleMode(hConsoleHandle: HANDLE, lpMode: LPDWORD) -> BOOL; - - pub fn GetSystemDirectoryW(lpBuffer: LPWSTR, uSize: UINT) -> UINT; - pub fn RemoveDirectoryW(lpPathName: LPCWSTR) -> BOOL; - pub fn SetFileAttributesW(lpFileName: LPCWSTR, dwFileAttributes: DWORD) -> BOOL; - pub fn SetFileTime( - hFile: BorrowedHandle<'_>, - lpCreationTime: Option<&FILETIME>, - lpLastAccessTime: Option<&FILETIME>, - lpLastWriteTime: Option<&FILETIME>, - ) -> BOOL; - pub fn SetLastError(dwErrCode: DWORD); - pub fn GetCommandLineW() -> LPWSTR; - pub fn GetTempPathW(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD; - pub fn GetCurrentProcess() -> HANDLE; - pub fn GetCurrentThread() -> HANDLE; - pub fn GetStdHandle(which: DWORD) -> HANDLE; - pub fn ExitProcess(uExitCode: c_uint) -> !; - pub fn DeviceIoControl( - hDevice: HANDLE, - dwIoControlCode: DWORD, - lpInBuffer: LPVOID, - nInBufferSize: DWORD, - lpOutBuffer: LPVOID, - nOutBufferSize: DWORD, - lpBytesReturned: LPDWORD, - lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn CreateThread( - lpThreadAttributes: LPSECURITY_ATTRIBUTES, - dwStackSize: SIZE_T, - lpStartAddress: extern "system" fn(*mut c_void) -> DWORD, - lpParameter: LPVOID, - dwCreationFlags: DWORD, - lpThreadId: LPDWORD, - ) -> HandleOrNull; - pub fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD; - pub fn SwitchToThread() -> BOOL; - pub fn Sleep(dwMilliseconds: DWORD); - pub fn SleepEx(dwMilliseconds: DWORD, bAlertable: BOOL) -> DWORD; - pub fn GetProcessId(handle: HANDLE) -> DWORD; - pub fn CopyFileExW( - lpExistingFileName: LPCWSTR, - lpNewFileName: LPCWSTR, - lpProgressRoutine: LPPROGRESS_ROUTINE, - lpData: LPVOID, - pbCancel: LPBOOL, - dwCopyFlags: DWORD, - ) -> BOOL; - pub fn FormatMessageW( - flags: DWORD, - lpSrc: LPVOID, - msgId: DWORD, - langId: DWORD, - buf: LPWSTR, - nsize: DWORD, - args: *const c_void, - ) -> DWORD; - pub fn TlsAlloc() -> DWORD; - pub fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID; - pub fn TlsSetValue(dwTlsIndex: DWORD, lpTlsvalue: LPVOID) -> BOOL; - pub fn TlsFree(dwTlsIndex: DWORD) -> BOOL; - pub fn GetLastError() -> DWORD; - pub fn QueryPerformanceFrequency(lpFrequency: *mut LARGE_INTEGER) -> BOOL; - pub fn QueryPerformanceCounter(lpPerformanceCount: *mut LARGE_INTEGER) -> BOOL; - pub fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: LPDWORD) -> BOOL; - pub fn TerminateProcess(hProcess: HANDLE, uExitCode: UINT) -> BOOL; - pub fn CreateProcessW( - lpApplicationName: LPCWSTR, - lpCommandLine: LPWSTR, - lpProcessAttributes: LPSECURITY_ATTRIBUTES, - lpThreadAttributes: LPSECURITY_ATTRIBUTES, - bInheritHandles: BOOL, - dwCreationFlags: DWORD, - lpEnvironment: LPVOID, - lpCurrentDirectory: LPCWSTR, - lpStartupInfo: LPSTARTUPINFO, - lpProcessInformation: LPPROCESS_INFORMATION, - ) -> BOOL; - pub fn GetEnvironmentVariableW(n: LPCWSTR, v: LPWSTR, nsize: DWORD) -> DWORD; - pub fn SetEnvironmentVariableW(n: LPCWSTR, v: LPCWSTR) -> BOOL; - pub fn GetEnvironmentStringsW() -> LPWCH; - pub fn FreeEnvironmentStringsW(env_ptr: LPWCH) -> BOOL; - pub fn GetModuleFileNameW(hModule: HMODULE, lpFilename: LPWSTR, nSize: DWORD) -> DWORD; - pub fn CreateDirectoryW( - lpPathName: LPCWSTR, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> BOOL; - pub fn DeleteFileW(lpPathName: LPCWSTR) -> BOOL; - pub fn GetCurrentDirectoryW(nBufferLength: DWORD, lpBuffer: LPWSTR) -> DWORD; - pub fn SetCurrentDirectoryW(lpPathName: LPCWSTR) -> BOOL; - pub fn DuplicateHandle( - hSourceProcessHandle: HANDLE, - hSourceHandle: HANDLE, - hTargetProcessHandle: HANDLE, - lpTargetHandle: LPHANDLE, - dwDesiredAccess: DWORD, - bInheritHandle: BOOL, - dwOptions: DWORD, - ) -> BOOL; - pub fn ReadFile( - hFile: BorrowedHandle<'_>, - lpBuffer: LPVOID, - nNumberOfBytesToRead: DWORD, - lpNumberOfBytesRead: LPDWORD, - lpOverlapped: LPOVERLAPPED, - ) -> BOOL; - pub fn ReadFileEx( - hFile: BorrowedHandle<'_>, - lpBuffer: LPVOID, - nNumberOfBytesToRead: DWORD, - lpOverlapped: LPOVERLAPPED, - lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, - ) -> BOOL; - pub fn WriteFileEx( - hFile: BorrowedHandle<'_>, - lpBuffer: LPVOID, - nNumberOfBytesToWrite: DWORD, - lpOverlapped: LPOVERLAPPED, - lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, - ) -> BOOL; - pub fn CloseHandle(hObject: HANDLE) -> BOOL; - pub fn MoveFileExW(lpExistingFileName: LPCWSTR, lpNewFileName: LPCWSTR, dwFlags: DWORD) - -> BOOL; - pub fn SetFilePointerEx( - hFile: HANDLE, - liDistanceToMove: LARGE_INTEGER, - lpNewFilePointer: PLARGE_INTEGER, - dwMoveMethod: DWORD, - ) -> BOOL; - pub fn FlushFileBuffers(hFile: HANDLE) -> BOOL; - pub fn CreateFileW( - lpFileName: LPCWSTR, - dwDesiredAccess: DWORD, - dwShareMode: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - dwCreationDisposition: DWORD, - dwFlagsAndAttributes: DWORD, - hTemplateFile: HANDLE, - ) -> HandleOrInvalid; - - pub fn FindFirstFileW(fileName: LPCWSTR, findFileData: LPWIN32_FIND_DATAW) -> HANDLE; - pub fn FindNextFileW(findFile: HANDLE, findFileData: LPWIN32_FIND_DATAW) -> BOOL; - pub fn FindClose(findFile: HANDLE) -> BOOL; - - pub fn GetProcAddress(handle: HMODULE, name: LPCSTR) -> *mut c_void; - pub fn GetModuleHandleA(lpModuleName: LPCSTR) -> HMODULE; - pub fn GetModuleHandleW(lpModuleName: LPCWSTR) -> HMODULE; - - pub fn GetSystemTimeAsFileTime(lpSystemTimeAsFileTime: LPFILETIME); - pub fn GetSystemInfo(lpSystemInfo: LPSYSTEM_INFO); - - pub fn CreateEventW( - lpEventAttributes: LPSECURITY_ATTRIBUTES, - bManualReset: BOOL, - bInitialState: BOOL, - lpName: LPCWSTR, - ) -> HANDLE; - pub fn WaitForMultipleObjects( - nCount: DWORD, - lpHandles: *const HANDLE, - bWaitAll: BOOL, - dwMilliseconds: DWORD, - ) -> DWORD; - pub fn CreateNamedPipeW( - lpName: LPCWSTR, - dwOpenMode: DWORD, - dwPipeMode: DWORD, - nMaxInstances: DWORD, - nOutBufferSize: DWORD, - nInBufferSize: DWORD, - nDefaultTimeOut: DWORD, - lpSecurityAttributes: LPSECURITY_ATTRIBUTES, - ) -> HANDLE; - pub fn CancelIo(handle: HANDLE) -> BOOL; - pub fn GetOverlappedResult( - hFile: HANDLE, - lpOverlapped: LPOVERLAPPED, - lpNumberOfBytesTransferred: LPDWORD, - bWait: BOOL, - ) -> BOOL; - pub fn CreateSymbolicLinkW( - lpSymlinkFileName: LPCWSTR, - lpTargetFileName: LPCWSTR, - dwFlags: DWORD, - ) -> BOOLEAN; - pub fn GetFinalPathNameByHandleW( - hFile: HANDLE, - lpszFilePath: LPCWSTR, - cchFilePath: DWORD, - dwFlags: DWORD, - ) -> DWORD; - pub fn GetFileInformationByHandleEx( - hFile: HANDLE, - fileInfoClass: FILE_INFO_BY_HANDLE_CLASS, - lpFileInformation: LPVOID, - dwBufferSize: DWORD, - ) -> BOOL; - pub fn SetFileInformationByHandle( - hFile: HANDLE, - FileInformationClass: FILE_INFO_BY_HANDLE_CLASS, - lpFileInformation: LPVOID, - dwBufferSize: DWORD, - ) -> BOOL; - pub fn GetFileType(hfile: HANDLE) -> DWORD; - pub fn SleepConditionVariableSRW( - ConditionVariable: PCONDITION_VARIABLE, - SRWLock: PSRWLOCK, - dwMilliseconds: DWORD, - Flags: ULONG, - ) -> BOOL; - - pub fn WakeConditionVariable(ConditionVariable: PCONDITION_VARIABLE); - pub fn WakeAllConditionVariable(ConditionVariable: PCONDITION_VARIABLE); - - pub fn AcquireSRWLockExclusive(SRWLock: PSRWLOCK); - pub fn AcquireSRWLockShared(SRWLock: PSRWLOCK); - pub fn ReleaseSRWLockExclusive(SRWLock: PSRWLOCK); - pub fn ReleaseSRWLockShared(SRWLock: PSRWLOCK); - pub fn TryAcquireSRWLockExclusive(SRWLock: PSRWLOCK) -> BOOLEAN; - pub fn TryAcquireSRWLockShared(SRWLock: PSRWLOCK) -> BOOLEAN; - - pub fn InitOnceBeginInitialize( - lpInitOnce: LPINIT_ONCE, - dwFlags: DWORD, - fPending: LPBOOL, - lpContext: *mut LPVOID, - ) -> BOOL; - pub fn InitOnceComplete(lpInitOnce: LPINIT_ONCE, dwFlags: DWORD, lpContext: LPVOID) -> BOOL; - - pub fn CompareStringOrdinal( - lpString1: LPCWSTR, - cchCount1: c_int, - lpString2: LPCWSTR, - cchCount2: c_int, - bIgnoreCase: BOOL, - ) -> c_int; - pub fn GetFullPathNameW( - lpFileName: LPCWSTR, - nBufferLength: DWORD, - lpBuffer: LPWSTR, - lpFilePart: *mut LPWSTR, - ) -> DWORD; - pub fn GetFileAttributesW(lpFileName: LPCWSTR) -> DWORD; - - pub fn MultiByteToWideChar( - CodePage: UINT, - dwFlags: DWORD, - lpMultiByteStr: LPCCH, - cbMultiByte: c_int, - lpWideCharStr: LPWSTR, - cchWideChar: c_int, - ) -> c_int; - pub fn WideCharToMultiByte( - CodePage: UINT, - dwFlags: DWORD, - lpWideCharStr: LPCWCH, - cchWideChar: c_int, - lpMultiByteStr: LPSTR, - cbMultiByte: c_int, - lpDefaultChar: LPCCH, - lpUsedDefaultChar: LPBOOL, - ) -> c_int; +pub unsafe extern "system" fn ReadFileEx( + hFile: BorrowedHandle<'_>, + lpBuffer: *mut ::core::ffi::c_void, + nNumberOfBytesToRead: u32, + lpOverlapped: *mut OVERLAPPED, + lpCompletionRoutine: LPOVERLAPPED_COMPLETION_ROUTINE, +) -> BOOL { + windows_sys::ReadFileEx( + hFile.as_raw_handle(), + lpBuffer, + nNumberOfBytesToRead, + lpOverlapped, + lpCompletionRoutine, + ) } -#[link(name = "ws2_32")] -extern "system" { - pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int; - pub fn WSACleanup() -> c_int; - pub fn WSAGetLastError() -> c_int; - pub fn WSADuplicateSocketW( - s: SOCKET, - dwProcessId: DWORD, - lpProtocolInfo: LPWSAPROTOCOL_INFO, - ) -> c_int; - pub fn WSASend( - s: SOCKET, - lpBuffers: LPWSABUF, - dwBufferCount: DWORD, - lpNumberOfBytesSent: LPDWORD, - dwFlags: DWORD, - lpOverlapped: LPWSAOVERLAPPED, - lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, - ) -> c_int; - pub fn WSARecv( - s: SOCKET, - lpBuffers: LPWSABUF, - dwBufferCount: DWORD, - lpNumberOfBytesRecvd: LPDWORD, - lpFlags: LPDWORD, - lpOverlapped: LPWSAOVERLAPPED, - lpCompletionRoutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, - ) -> c_int; - pub fn WSASocketW( - af: c_int, - kind: c_int, - protocol: c_int, - lpProtocolInfo: LPWSAPROTOCOL_INFO, - g: GROUP, - dwFlags: DWORD, - ) -> SOCKET; - pub fn ioctlsocket(s: SOCKET, cmd: c_long, argp: *mut c_ulong) -> c_int; - pub fn closesocket(socket: SOCKET) -> c_int; - pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int; - pub fn send(socket: SOCKET, buf: *const c_void, len: c_int, flags: c_int) -> c_int; - pub fn recvfrom( - socket: SOCKET, - buf: *mut c_void, - len: c_int, - flags: c_int, - addr: *mut SOCKADDR, - addrlen: *mut c_int, - ) -> c_int; - pub fn sendto( - socket: SOCKET, - buf: *const c_void, - len: c_int, - flags: c_int, - addr: *const SOCKADDR, - addrlen: c_int, - ) -> c_int; - pub fn shutdown(socket: SOCKET, how: c_int) -> c_int; - pub fn accept(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> SOCKET; - pub fn getsockopt( - s: SOCKET, - level: c_int, - optname: c_int, - optval: *mut c_char, - optlen: *mut c_int, - ) -> c_int; - pub fn setsockopt( - s: SOCKET, - level: c_int, - optname: c_int, - optval: *const c_void, - optlen: c_int, - ) -> c_int; - pub fn getsockname(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> c_int; - pub fn getpeername(socket: SOCKET, address: *mut SOCKADDR, address_len: *mut c_int) -> c_int; - pub fn bind(socket: SOCKET, address: *const SOCKADDR, address_len: socklen_t) -> c_int; - pub fn listen(socket: SOCKET, backlog: c_int) -> c_int; - pub fn connect(socket: SOCKET, address: *const SOCKADDR, len: c_int) -> c_int; - pub fn getaddrinfo( - node: *const c_char, - service: *const c_char, - hints: *const ADDRINFOA, - res: *mut *mut ADDRINFOA, - ) -> c_int; - pub fn freeaddrinfo(res: *mut ADDRINFOA); - pub fn select( - nfds: c_int, - readfds: *mut fd_set, - writefds: *mut fd_set, - exceptfds: *mut fd_set, - timeout: *const timeval, - ) -> c_int; +// POSIX compatibility shims. +pub unsafe fn recv(socket: SOCKET, buf: *mut c_void, len: c_int, flags: c_int) -> c_int { + windows_sys::recv(socket, buf.cast::(), len, flags) +} +pub unsafe fn send(socket: SOCKET, buf: *const c_void, len: c_int, flags: c_int) -> c_int { + windows_sys::send(socket, buf.cast::(), len, flags) +} +pub unsafe fn recvfrom( + socket: SOCKET, + buf: *mut c_void, + len: c_int, + flags: c_int, + addr: *mut SOCKADDR, + addrlen: *mut c_int, +) -> c_int { + windows_sys::recvfrom(socket, buf.cast::(), len, flags, addr, addrlen) +} +pub unsafe fn sendto( + socket: SOCKET, + buf: *const c_void, + len: c_int, + flags: c_int, + addr: *const SOCKADDR, + addrlen: c_int, +) -> c_int { + windows_sys::sendto(socket, buf.cast::(), len, flags, addr, addrlen) +} +pub unsafe fn getaddrinfo( + node: *const c_char, + service: *const c_char, + hints: *const ADDRINFOA, + res: *mut *mut ADDRINFOA, +) -> c_int { + windows_sys::getaddrinfo(node.cast::(), service.cast::(), hints, res) } -#[link(name = "bcrypt")] -extern "system" { - // >= Vista / Server 2008 - // https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom - pub fn BCryptGenRandom( - hAlgorithm: BCRYPT_ALG_HANDLE, - pBuffer: *mut u8, - cbBuffer: ULONG, - dwFlags: ULONG, - ) -> NTSTATUS; +pub unsafe fn NtReadFile( + filehandle: BorrowedHandle<'_>, + event: HANDLE, + apcroutine: PIO_APC_ROUTINE, + apccontext: *mut c_void, + iostatusblock: &mut IO_STATUS_BLOCK, + buffer: *mut crate::mem::MaybeUninit, + length: ULONG, + byteoffset: Option<&LARGE_INTEGER>, + key: Option<&ULONG>, +) -> NTSTATUS { + windows_sys::NtReadFile( + filehandle.as_raw_handle(), + event, + apcroutine, + apccontext, + iostatusblock, + buffer.cast::(), + length, + byteoffset.map(|o| o as *const i64).unwrap_or(ptr::null()), + key.map(|k| k as *const u32).unwrap_or(ptr::null()), + ) } - -#[link(name = "ntdll")] -extern "system" { - pub fn NtCreateFile( - FileHandle: *mut HANDLE, - DesiredAccess: ACCESS_MASK, - ObjectAttributes: *const OBJECT_ATTRIBUTES, - IoStatusBlock: *mut IO_STATUS_BLOCK, - AllocationSize: *mut i64, - FileAttributes: ULONG, - ShareAccess: ULONG, - CreateDisposition: ULONG, - CreateOptions: ULONG, - EaBuffer: *mut c_void, - EaLength: ULONG, - ) -> NTSTATUS; - pub fn NtReadFile( - FileHandle: BorrowedHandle<'_>, - Event: HANDLE, - ApcRoutine: Option, - ApcContext: *mut c_void, - IoStatusBlock: &mut IO_STATUS_BLOCK, - Buffer: *mut crate::mem::MaybeUninit, - Length: ULONG, - ByteOffset: Option<&LARGE_INTEGER>, - Key: Option<&ULONG>, - ) -> NTSTATUS; - pub fn NtWriteFile( - FileHandle: BorrowedHandle<'_>, - Event: HANDLE, - ApcRoutine: Option, - ApcContext: *mut c_void, - IoStatusBlock: &mut IO_STATUS_BLOCK, - Buffer: *const u8, - Length: ULONG, - ByteOffset: Option<&LARGE_INTEGER>, - Key: Option<&ULONG>, - ) -> NTSTATUS; - pub fn RtlNtStatusToDosError(Status: NTSTATUS) -> ULONG; +pub unsafe fn NtWriteFile( + filehandle: BorrowedHandle<'_>, + event: HANDLE, + apcroutine: PIO_APC_ROUTINE, + apccontext: *mut c_void, + iostatusblock: &mut IO_STATUS_BLOCK, + buffer: *const u8, + length: ULONG, + byteoffset: Option<&LARGE_INTEGER>, + key: Option<&ULONG>, +) -> NTSTATUS { + windows_sys::NtWriteFile( + filehandle.as_raw_handle(), + event, + apcroutine, + apccontext, + iostatusblock, + buffer.cast::(), + length, + byteoffset.map(|o| o as *const i64).unwrap_or(ptr::null()), + key.map(|k| k as *const u32).unwrap_or(ptr::null()), + ) } // Functions that aren't available on every version of Windows that we support, @@ -1328,34 +321,32 @@ compat_fn_with_fallback! { // >= Win10 1607 // https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-setthreaddescription - pub fn SetThreadDescription(hThread: HANDLE, - lpThreadDescription: LPCWSTR) -> HRESULT { + pub fn SetThreadDescription(hthread: HANDLE, lpthreaddescription: PCWSTR) -> HRESULT { SetLastError(ERROR_CALL_NOT_IMPLEMENTED as DWORD); E_NOTIMPL } // >= Win8 / Server 2012 // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-getsystemtimepreciseasfiletime - pub fn GetSystemTimePreciseAsFileTime(lpSystemTimeAsFileTime: LPFILETIME) - -> () { - GetSystemTimeAsFileTime(lpSystemTimeAsFileTime) + pub fn GetSystemTimePreciseAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> () { + GetSystemTimeAsFileTime(lpsystemtimeasfiletime) } // >= Win11 / Server 2022 // https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-gettemppath2a - pub fn GetTempPath2W(nBufferLength: DWORD, lpBuffer: LPCWSTR) -> DWORD { - GetTempPathW(nBufferLength, lpBuffer) + pub fn GetTempPath2W(bufferlength: u32, buffer: PWSTR) -> u32 { + GetTempPathW(bufferlength, buffer) } } compat_fn_optional! { crate::sys::compat::load_synch_functions(); pub fn WaitOnAddress( - Address: LPVOID, - CompareAddress: LPVOID, - AddressSize: SIZE_T, - dwMilliseconds: DWORD - ); - pub fn WakeByAddressSingle(Address: LPVOID); + address: *const ::core::ffi::c_void, + compareaddress: *const ::core::ffi::c_void, + addresssize: usize, + dwmilliseconds: u32 + ) -> BOOL; + pub fn WakeByAddressSingle(address: *const ::core::ffi::c_void); } compat_fn_with_fallback! { diff --git a/library/std/src/sys/windows/c/errors.rs b/library/std/src/sys/windows/c/errors.rs deleted file mode 100644 index ad8da19b6daa..000000000000 --- a/library/std/src/sys/windows/c/errors.rs +++ /dev/null @@ -1,1883 +0,0 @@ -// List of Windows system error codes with descriptions: -// https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes#system-error-codes - -#![allow(dead_code)] - -use super::{c_int, DWORD}; - -pub const ERROR_DIRECTORY_NOT_SUPPORTED: DWORD = 336; -pub const ERROR_DRIVER_CANCEL_TIMEOUT: DWORD = 594; -pub const ERROR_DISK_QUOTA_EXCEEDED: DWORD = 1295; -pub const ERROR_RESOURCE_CALL_TIMED_OUT: DWORD = 5910; -pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: DWORD = 8014; -pub const DNS_ERROR_RECORD_TIMED_OUT: DWORD = 9705; - -// The following list was obtained from -// `/usr/x86_64-w64-mingw32/include/winerror.h` -// in the Debian package -// mingw-w64_6.0.0-3_all.deb -// -// The header of that file says: -// * This file has no copyright assigned and is placed in the Public Domain. -// * This file is part of the mingw-w64 runtime package. -// * No warranty is given; refer to the file DISCLAIMER.PD within this package. -// -// The text here is the result of the following rune: -// grep -P '#define ERROR' /usr/x86_64-w64-mingw32/include/winerror.h >>library/std/src/sys/windows/c/errors.rs -// grep -P '#define WSA' /usr/x86_64-w64-mingw32/include/winerror.h >>library/std/src/sys/windows/c/errors.rs -// and then using some manually-invented but rather obvious editor search-and-replace -// invocations, plus some straightforward manual fixups, to turn it into Rust syntax -// and remove all the duplicates from the manual table above. - -pub const ERROR_SUCCESS: DWORD = 0; -pub const ERROR_INVALID_FUNCTION: DWORD = 1; -pub const ERROR_FILE_NOT_FOUND: DWORD = 2; -pub const ERROR_PATH_NOT_FOUND: DWORD = 3; -pub const ERROR_TOO_MANY_OPEN_FILES: DWORD = 4; -pub const ERROR_ACCESS_DENIED: DWORD = 5; -pub const ERROR_INVALID_HANDLE: DWORD = 6; -pub const ERROR_ARENA_TRASHED: DWORD = 7; -pub const ERROR_NOT_ENOUGH_MEMORY: DWORD = 8; -pub const ERROR_INVALID_BLOCK: DWORD = 9; -pub const ERROR_BAD_ENVIRONMENT: DWORD = 10; -pub const ERROR_BAD_FORMAT: DWORD = 11; -pub const ERROR_INVALID_ACCESS: DWORD = 12; -pub const ERROR_INVALID_DATA: DWORD = 13; -pub const ERROR_OUTOFMEMORY: DWORD = 14; -pub const ERROR_INVALID_DRIVE: DWORD = 15; -pub const ERROR_CURRENT_DIRECTORY: DWORD = 16; -pub const ERROR_NOT_SAME_DEVICE: DWORD = 17; -pub const ERROR_NO_MORE_FILES: DWORD = 18; -pub const ERROR_WRITE_PROTECT: DWORD = 19; -pub const ERROR_BAD_UNIT: DWORD = 20; -pub const ERROR_NOT_READY: DWORD = 21; -pub const ERROR_BAD_COMMAND: DWORD = 22; -pub const ERROR_CRC: DWORD = 23; -pub const ERROR_BAD_LENGTH: DWORD = 24; -pub const ERROR_SEEK: DWORD = 25; -pub const ERROR_NOT_DOS_DISK: DWORD = 26; -pub const ERROR_SECTOR_NOT_FOUND: DWORD = 27; -pub const ERROR_OUT_OF_PAPER: DWORD = 28; -pub const ERROR_WRITE_FAULT: DWORD = 29; -pub const ERROR_READ_FAULT: DWORD = 30; -pub const ERROR_GEN_FAILURE: DWORD = 31; -pub const ERROR_SHARING_VIOLATION: DWORD = 32; -pub const ERROR_LOCK_VIOLATION: DWORD = 33; -pub const ERROR_WRONG_DISK: DWORD = 34; -pub const ERROR_SHARING_BUFFER_EXCEEDED: DWORD = 36; -pub const ERROR_HANDLE_EOF: DWORD = 38; -pub const ERROR_HANDLE_DISK_FULL: DWORD = 39; -pub const ERROR_NOT_SUPPORTED: DWORD = 50; -pub const ERROR_REM_NOT_LIST: DWORD = 51; -pub const ERROR_DUP_NAME: DWORD = 52; -pub const ERROR_BAD_NETPATH: DWORD = 53; -pub const ERROR_NETWORK_BUSY: DWORD = 54; -pub const ERROR_DEV_NOT_EXIST: DWORD = 55; -pub const ERROR_TOO_MANY_CMDS: DWORD = 56; -pub const ERROR_ADAP_HDW_ERR: DWORD = 57; -pub const ERROR_BAD_NET_RESP: DWORD = 58; -pub const ERROR_UNEXP_NET_ERR: DWORD = 59; -pub const ERROR_BAD_REM_ADAP: DWORD = 60; -pub const ERROR_PRINTQ_FULL: DWORD = 61; -pub const ERROR_NO_SPOOL_SPACE: DWORD = 62; -pub const ERROR_PRINT_CANCELLED: DWORD = 63; -pub const ERROR_NETNAME_DELETED: DWORD = 64; -pub const ERROR_NETWORK_ACCESS_DENIED: DWORD = 65; -pub const ERROR_BAD_DEV_TYPE: DWORD = 66; -pub const ERROR_BAD_NET_NAME: DWORD = 67; -pub const ERROR_TOO_MANY_NAMES: DWORD = 68; -pub const ERROR_TOO_MANY_SESS: DWORD = 69; -pub const ERROR_SHARING_PAUSED: DWORD = 70; -pub const ERROR_REQ_NOT_ACCEP: DWORD = 71; -pub const ERROR_REDIR_PAUSED: DWORD = 72; -pub const ERROR_FILE_EXISTS: DWORD = 80; -pub const ERROR_CANNOT_MAKE: DWORD = 82; -pub const ERROR_FAIL_I24: DWORD = 83; -pub const ERROR_OUT_OF_STRUCTURES: DWORD = 84; -pub const ERROR_ALREADY_ASSIGNED: DWORD = 85; -pub const ERROR_INVALID_PASSWORD: DWORD = 86; -pub const ERROR_INVALID_PARAMETER: DWORD = 87; -pub const ERROR_NET_WRITE_FAULT: DWORD = 88; -pub const ERROR_NO_PROC_SLOTS: DWORD = 89; -pub const ERROR_TOO_MANY_SEMAPHORES: DWORD = 100; -pub const ERROR_EXCL_SEM_ALREADY_OWNED: DWORD = 101; -pub const ERROR_SEM_IS_SET: DWORD = 102; -pub const ERROR_TOO_MANY_SEM_REQUESTS: DWORD = 103; -pub const ERROR_INVALID_AT_INTERRUPT_TIME: DWORD = 104; -pub const ERROR_SEM_OWNER_DIED: DWORD = 105; -pub const ERROR_SEM_USER_LIMIT: DWORD = 106; -pub const ERROR_DISK_CHANGE: DWORD = 107; -pub const ERROR_DRIVE_LOCKED: DWORD = 108; -pub const ERROR_BROKEN_PIPE: DWORD = 109; -pub const ERROR_OPEN_FAILED: DWORD = 110; -pub const ERROR_BUFFER_OVERFLOW: DWORD = 111; -pub const ERROR_DISK_FULL: DWORD = 112; -pub const ERROR_NO_MORE_SEARCH_HANDLES: DWORD = 113; -pub const ERROR_INVALID_TARGET_HANDLE: DWORD = 114; -pub const ERROR_INVALID_CATEGORY: DWORD = 117; -pub const ERROR_INVALID_VERIFY_SWITCH: DWORD = 118; -pub const ERROR_BAD_DRIVER_LEVEL: DWORD = 119; -pub const ERROR_CALL_NOT_IMPLEMENTED: DWORD = 120; -pub const ERROR_SEM_TIMEOUT: DWORD = 121; -pub const ERROR_INSUFFICIENT_BUFFER: DWORD = 122; -pub const ERROR_INVALID_NAME: DWORD = 123; -pub const ERROR_INVALID_LEVEL: DWORD = 124; -pub const ERROR_NO_VOLUME_LABEL: DWORD = 125; -pub const ERROR_MOD_NOT_FOUND: DWORD = 126; -pub const ERROR_PROC_NOT_FOUND: DWORD = 127; -pub const ERROR_WAIT_NO_CHILDREN: DWORD = 128; -pub const ERROR_CHILD_NOT_COMPLETE: DWORD = 129; -pub const ERROR_DIRECT_ACCESS_HANDLE: DWORD = 130; -pub const ERROR_NEGATIVE_SEEK: DWORD = 131; -pub const ERROR_SEEK_ON_DEVICE: DWORD = 132; -pub const ERROR_IS_JOIN_TARGET: DWORD = 133; -pub const ERROR_IS_JOINED: DWORD = 134; -pub const ERROR_IS_SUBSTED: DWORD = 135; -pub const ERROR_NOT_JOINED: DWORD = 136; -pub const ERROR_NOT_SUBSTED: DWORD = 137; -pub const ERROR_JOIN_TO_JOIN: DWORD = 138; -pub const ERROR_SUBST_TO_SUBST: DWORD = 139; -pub const ERROR_JOIN_TO_SUBST: DWORD = 140; -pub const ERROR_SUBST_TO_JOIN: DWORD = 141; -pub const ERROR_BUSY_DRIVE: DWORD = 142; -pub const ERROR_SAME_DRIVE: DWORD = 143; -pub const ERROR_DIR_NOT_ROOT: DWORD = 144; -pub const ERROR_DIR_NOT_EMPTY: DWORD = 145; -pub const ERROR_IS_SUBST_PATH: DWORD = 146; -pub const ERROR_IS_JOIN_PATH: DWORD = 147; -pub const ERROR_PATH_BUSY: DWORD = 148; -pub const ERROR_IS_SUBST_TARGET: DWORD = 149; -pub const ERROR_SYSTEM_TRACE: DWORD = 150; -pub const ERROR_INVALID_EVENT_COUNT: DWORD = 151; -pub const ERROR_TOO_MANY_MUXWAITERS: DWORD = 152; -pub const ERROR_INVALID_LIST_FORMAT: DWORD = 153; -pub const ERROR_LABEL_TOO_LONG: DWORD = 154; -pub const ERROR_TOO_MANY_TCBS: DWORD = 155; -pub const ERROR_SIGNAL_REFUSED: DWORD = 156; -pub const ERROR_DISCARDED: DWORD = 157; -pub const ERROR_NOT_LOCKED: DWORD = 158; -pub const ERROR_BAD_THREADID_ADDR: DWORD = 159; -pub const ERROR_BAD_ARGUMENTS: DWORD = 160; -pub const ERROR_BAD_PATHNAME: DWORD = 161; -pub const ERROR_SIGNAL_PENDING: DWORD = 162; -pub const ERROR_MAX_THRDS_REACHED: DWORD = 164; -pub const ERROR_LOCK_FAILED: DWORD = 167; -pub const ERROR_BUSY: DWORD = 170; -pub const ERROR_CANCEL_VIOLATION: DWORD = 173; -pub const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED: DWORD = 174; -pub const ERROR_INVALID_SEGMENT_NUMBER: DWORD = 180; -pub const ERROR_INVALID_ORDINAL: DWORD = 182; -pub const ERROR_ALREADY_EXISTS: DWORD = 183; -pub const ERROR_INVALID_FLAG_NUMBER: DWORD = 186; -pub const ERROR_SEM_NOT_FOUND: DWORD = 187; -pub const ERROR_INVALID_STARTING_CODESEG: DWORD = 188; -pub const ERROR_INVALID_STACKSEG: DWORD = 189; -pub const ERROR_INVALID_MODULETYPE: DWORD = 190; -pub const ERROR_INVALID_EXE_SIGNATURE: DWORD = 191; -pub const ERROR_EXE_MARKED_INVALID: DWORD = 192; -pub const ERROR_BAD_EXE_FORMAT: DWORD = 193; -pub const ERROR_ITERATED_DATA_EXCEEDS_64k: DWORD = 194; -pub const ERROR_INVALID_MINALLOCSIZE: DWORD = 195; -pub const ERROR_DYNLINK_FROM_INVALID_RING: DWORD = 196; -pub const ERROR_IOPL_NOT_ENABLED: DWORD = 197; -pub const ERROR_INVALID_SEGDPL: DWORD = 198; -pub const ERROR_AUTODATASEG_EXCEEDS_64k: DWORD = 199; -pub const ERROR_RING2SEG_MUST_BE_MOVABLE: DWORD = 200; -pub const ERROR_RELOC_CHAIN_XEEDS_SEGLIM: DWORD = 201; -pub const ERROR_INFLOOP_IN_RELOC_CHAIN: DWORD = 202; -pub const ERROR_ENVVAR_NOT_FOUND: DWORD = 203; -pub const ERROR_NO_SIGNAL_SENT: DWORD = 205; -pub const ERROR_FILENAME_EXCED_RANGE: DWORD = 206; -pub const ERROR_RING2_STACK_IN_USE: DWORD = 207; -pub const ERROR_META_EXPANSION_TOO_LONG: DWORD = 208; -pub const ERROR_INVALID_SIGNAL_NUMBER: DWORD = 209; -pub const ERROR_THREAD_1_INACTIVE: DWORD = 210; -pub const ERROR_LOCKED: DWORD = 212; -pub const ERROR_TOO_MANY_MODULES: DWORD = 214; -pub const ERROR_NESTING_NOT_ALLOWED: DWORD = 215; -pub const ERROR_EXE_MACHINE_TYPE_MISMATCH: DWORD = 216; -pub const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY: DWORD = 217; -pub const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY: DWORD = 218; -pub const ERROR_FILE_CHECKED_OUT: DWORD = 220; -pub const ERROR_CHECKOUT_REQUIRED: DWORD = 221; -pub const ERROR_BAD_FILE_TYPE: DWORD = 222; -pub const ERROR_FILE_TOO_LARGE: DWORD = 223; -pub const ERROR_FORMS_AUTH_REQUIRED: DWORD = 224; -pub const ERROR_PIPE_LOCAL: DWORD = 229; -pub const ERROR_BAD_PIPE: DWORD = 230; -pub const ERROR_PIPE_BUSY: DWORD = 231; -pub const ERROR_NO_DATA: DWORD = 232; -pub const ERROR_PIPE_NOT_CONNECTED: DWORD = 233; -pub const ERROR_MORE_DATA: DWORD = 234; -pub const ERROR_VC_DISCONNECTED: DWORD = 240; -pub const ERROR_INVALID_EA_NAME: DWORD = 254; -pub const ERROR_EA_LIST_INCONSISTENT: DWORD = 255; -pub const ERROR_NO_MORE_ITEMS: DWORD = 259; -pub const ERROR_CANNOT_COPY: DWORD = 266; -pub const ERROR_DIRECTORY: DWORD = 267; -pub const ERROR_EAS_DIDNT_FIT: DWORD = 275; -pub const ERROR_EA_FILE_CORRUPT: DWORD = 276; -pub const ERROR_EA_TABLE_FULL: DWORD = 277; -pub const ERROR_INVALID_EA_HANDLE: DWORD = 278; -pub const ERROR_EAS_NOT_SUPPORTED: DWORD = 282; -pub const ERROR_NOT_OWNER: DWORD = 288; -pub const ERROR_TOO_MANY_POSTS: DWORD = 298; -pub const ERROR_PARTIAL_COPY: DWORD = 299; -pub const ERROR_OPLOCK_NOT_GRANTED: DWORD = 300; -pub const ERROR_INVALID_OPLOCK_PROTOCOL: DWORD = 301; -pub const ERROR_DISK_TOO_FRAGMENTED: DWORD = 302; -pub const ERROR_DELETE_PENDING: DWORD = 303; -pub const ERROR_INVALID_TOKEN: DWORD = 315; -pub const ERROR_MR_MID_NOT_FOUND: DWORD = 317; -pub const ERROR_SCOPE_NOT_FOUND: DWORD = 318; -pub const ERROR_INVALID_ADDRESS: DWORD = 487; -pub const ERROR_ARITHMETIC_OVERFLOW: DWORD = 534; -pub const ERROR_PIPE_CONNECTED: DWORD = 535; -pub const ERROR_PIPE_LISTENING: DWORD = 536; -pub const ERROR_WAKE_SYSTEM: DWORD = 730; -pub const ERROR_WAIT_1: DWORD = 731; -pub const ERROR_WAIT_2: DWORD = 732; -pub const ERROR_WAIT_3: DWORD = 733; -pub const ERROR_WAIT_63: DWORD = 734; -pub const ERROR_ABANDONED_WAIT_0: DWORD = 735; -pub const ERROR_ABANDONED_WAIT_63: DWORD = 736; -pub const ERROR_USER_APC: DWORD = 737; -pub const ERROR_KERNEL_APC: DWORD = 738; -pub const ERROR_ALERTED: DWORD = 739; -pub const ERROR_EA_ACCESS_DENIED: DWORD = 994; -pub const ERROR_OPERATION_ABORTED: DWORD = 995; -pub const ERROR_IO_INCOMPLETE: DWORD = 996; -pub const ERROR_IO_PENDING: DWORD = 997; -pub const ERROR_NOACCESS: DWORD = 998; -pub const ERROR_SWAPERROR: DWORD = 999; -pub const ERROR_STACK_OVERFLOW: DWORD = 1001; -pub const ERROR_INVALID_MESSAGE: DWORD = 1002; -pub const ERROR_CAN_NOT_COMPLETE: DWORD = 1003; -pub const ERROR_INVALID_FLAGS: DWORD = 1004; -pub const ERROR_UNRECOGNIZED_VOLUME: DWORD = 1005; -pub const ERROR_FILE_INVALID: DWORD = 1006; -pub const ERROR_FULLSCREEN_MODE: DWORD = 1007; -pub const ERROR_NO_TOKEN: DWORD = 1008; -pub const ERROR_BADDB: DWORD = 1009; -pub const ERROR_BADKEY: DWORD = 1010; -pub const ERROR_CANTOPEN: DWORD = 1011; -pub const ERROR_CANTREAD: DWORD = 1012; -pub const ERROR_CANTWRITE: DWORD = 1013; -pub const ERROR_REGISTRY_RECOVERED: DWORD = 1014; -pub const ERROR_REGISTRY_CORRUPT: DWORD = 1015; -pub const ERROR_REGISTRY_IO_FAILED: DWORD = 1016; -pub const ERROR_NOT_REGISTRY_FILE: DWORD = 1017; -pub const ERROR_KEY_DELETED: DWORD = 1018; -pub const ERROR_NO_LOG_SPACE: DWORD = 1019; -pub const ERROR_KEY_HAS_CHILDREN: DWORD = 1020; -pub const ERROR_CHILD_MUST_BE_VOLATILE: DWORD = 1021; -pub const ERROR_NOTIFY_ENUM_DIR: DWORD = 1022; -pub const ERROR_DEPENDENT_SERVICES_RUNNING: DWORD = 1051; -pub const ERROR_INVALID_SERVICE_CONTROL: DWORD = 1052; -pub const ERROR_SERVICE_REQUEST_TIMEOUT: DWORD = 1053; -pub const ERROR_SERVICE_NO_THREAD: DWORD = 1054; -pub const ERROR_SERVICE_DATABASE_LOCKED: DWORD = 1055; -pub const ERROR_SERVICE_ALREADY_RUNNING: DWORD = 1056; -pub const ERROR_INVALID_SERVICE_ACCOUNT: DWORD = 1057; -pub const ERROR_SERVICE_DISABLED: DWORD = 1058; -pub const ERROR_CIRCULAR_DEPENDENCY: DWORD = 1059; -pub const ERROR_SERVICE_DOES_NOT_EXIST: DWORD = 1060; -pub const ERROR_SERVICE_CANNOT_ACCEPT_CTRL: DWORD = 1061; -pub const ERROR_SERVICE_NOT_ACTIVE: DWORD = 1062; -pub const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: DWORD = 1063; -pub const ERROR_EXCEPTION_IN_SERVICE: DWORD = 1064; -pub const ERROR_DATABASE_DOES_NOT_EXIST: DWORD = 1065; -pub const ERROR_SERVICE_SPECIFIC_ERROR: DWORD = 1066; -pub const ERROR_PROCESS_ABORTED: DWORD = 1067; -pub const ERROR_SERVICE_DEPENDENCY_FAIL: DWORD = 1068; -pub const ERROR_SERVICE_LOGON_FAILED: DWORD = 1069; -pub const ERROR_SERVICE_START_HANG: DWORD = 1070; -pub const ERROR_INVALID_SERVICE_LOCK: DWORD = 1071; -pub const ERROR_SERVICE_MARKED_FOR_DELETE: DWORD = 1072; -pub const ERROR_SERVICE_EXISTS: DWORD = 1073; -pub const ERROR_ALREADY_RUNNING_LKG: DWORD = 1074; -pub const ERROR_SERVICE_DEPENDENCY_DELETED: DWORD = 1075; -pub const ERROR_BOOT_ALREADY_ACCEPTED: DWORD = 1076; -pub const ERROR_SERVICE_NEVER_STARTED: DWORD = 1077; -pub const ERROR_DUPLICATE_SERVICE_NAME: DWORD = 1078; -pub const ERROR_DIFFERENT_SERVICE_ACCOUNT: DWORD = 1079; -pub const ERROR_CANNOT_DETECT_DRIVER_FAILURE: DWORD = 1080; -pub const ERROR_CANNOT_DETECT_PROCESS_ABORT: DWORD = 1081; -pub const ERROR_NO_RECOVERY_PROGRAM: DWORD = 1082; -pub const ERROR_SERVICE_NOT_IN_EXE: DWORD = 1083; -pub const ERROR_NOT_SAFEBOOT_SERVICE: DWORD = 1084; -pub const ERROR_END_OF_MEDIA: DWORD = 1100; -pub const ERROR_FILEMARK_DETECTED: DWORD = 1101; -pub const ERROR_BEGINNING_OF_MEDIA: DWORD = 1102; -pub const ERROR_SETMARK_DETECTED: DWORD = 1103; -pub const ERROR_NO_DATA_DETECTED: DWORD = 1104; -pub const ERROR_PARTITION_FAILURE: DWORD = 1105; -pub const ERROR_INVALID_BLOCK_LENGTH: DWORD = 1106; -pub const ERROR_DEVICE_NOT_PARTITIONED: DWORD = 1107; -pub const ERROR_UNABLE_TO_LOCK_MEDIA: DWORD = 1108; -pub const ERROR_UNABLE_TO_UNLOAD_MEDIA: DWORD = 1109; -pub const ERROR_MEDIA_CHANGED: DWORD = 1110; -pub const ERROR_BUS_RESET: DWORD = 1111; -pub const ERROR_NO_MEDIA_IN_DRIVE: DWORD = 1112; -pub const ERROR_NO_UNICODE_TRANSLATION: DWORD = 1113; -pub const ERROR_DLL_INIT_FAILED: DWORD = 1114; -pub const ERROR_SHUTDOWN_IN_PROGRESS: DWORD = 1115; -pub const ERROR_NO_SHUTDOWN_IN_PROGRESS: DWORD = 1116; -pub const ERROR_IO_DEVICE: DWORD = 1117; -pub const ERROR_SERIAL_NO_DEVICE: DWORD = 1118; -pub const ERROR_IRQ_BUSY: DWORD = 1119; -pub const ERROR_MORE_WRITES: DWORD = 1120; -pub const ERROR_COUNTER_TIMEOUT: DWORD = 1121; -pub const ERROR_FLOPPY_ID_MARK_NOT_FOUND: DWORD = 1122; -pub const ERROR_FLOPPY_WRONG_CYLINDER: DWORD = 1123; -pub const ERROR_FLOPPY_UNKNOWN_ERROR: DWORD = 1124; -pub const ERROR_FLOPPY_BAD_REGISTERS: DWORD = 1125; -pub const ERROR_DISK_RECALIBRATE_FAILED: DWORD = 1126; -pub const ERROR_DISK_OPERATION_FAILED: DWORD = 1127; -pub const ERROR_DISK_RESET_FAILED: DWORD = 1128; -pub const ERROR_EOM_OVERFLOW: DWORD = 1129; -pub const ERROR_NOT_ENOUGH_SERVER_MEMORY: DWORD = 1130; -pub const ERROR_POSSIBLE_DEADLOCK: DWORD = 1131; -pub const ERROR_MAPPED_ALIGNMENT: DWORD = 1132; -pub const ERROR_SET_POWER_STATE_VETOED: DWORD = 1140; -pub const ERROR_SET_POWER_STATE_FAILED: DWORD = 1141; -pub const ERROR_TOO_MANY_LINKS: DWORD = 1142; -pub const ERROR_OLD_WIN_VERSION: DWORD = 1150; -pub const ERROR_APP_WRONG_OS: DWORD = 1151; -pub const ERROR_SINGLE_INSTANCE_APP: DWORD = 1152; -pub const ERROR_RMODE_APP: DWORD = 1153; -pub const ERROR_INVALID_DLL: DWORD = 1154; -pub const ERROR_NO_ASSOCIATION: DWORD = 1155; -pub const ERROR_DDE_FAIL: DWORD = 1156; -pub const ERROR_DLL_NOT_FOUND: DWORD = 1157; -pub const ERROR_NO_MORE_USER_HANDLES: DWORD = 1158; -pub const ERROR_MESSAGE_SYNC_ONLY: DWORD = 1159; -pub const ERROR_SOURCE_ELEMENT_EMPTY: DWORD = 1160; -pub const ERROR_DESTINATION_ELEMENT_FULL: DWORD = 1161; -pub const ERROR_ILLEGAL_ELEMENT_ADDRESS: DWORD = 1162; -pub const ERROR_MAGAZINE_NOT_PRESENT: DWORD = 1163; -pub const ERROR_DEVICE_REINITIALIZATION_NEEDED: DWORD = 1164; -pub const ERROR_DEVICE_REQUIRES_CLEANING: DWORD = 1165; -pub const ERROR_DEVICE_DOOR_OPEN: DWORD = 1166; -pub const ERROR_DEVICE_NOT_CONNECTED: DWORD = 1167; -pub const ERROR_NOT_FOUND: DWORD = 1168; -pub const ERROR_NO_MATCH: DWORD = 1169; -pub const ERROR_SET_NOT_FOUND: DWORD = 1170; -pub const ERROR_POINT_NOT_FOUND: DWORD = 1171; -pub const ERROR_NO_TRACKING_SERVICE: DWORD = 1172; -pub const ERROR_NO_VOLUME_ID: DWORD = 1173; -pub const ERROR_UNABLE_TO_REMOVE_REPLACED: DWORD = 1175; -pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT: DWORD = 1176; -pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2: DWORD = 1177; -pub const ERROR_JOURNAL_DELETE_IN_PROGRESS: DWORD = 1178; -pub const ERROR_JOURNAL_NOT_ACTIVE: DWORD = 1179; -pub const ERROR_POTENTIAL_FILE_FOUND: DWORD = 1180; -pub const ERROR_JOURNAL_ENTRY_DELETED: DWORD = 1181; -pub const ERROR_BAD_DEVICE: DWORD = 1200; -pub const ERROR_CONNECTION_UNAVAIL: DWORD = 1201; -pub const ERROR_DEVICE_ALREADY_REMEMBERED: DWORD = 1202; -pub const ERROR_NO_NET_OR_BAD_PATH: DWORD = 1203; -pub const ERROR_BAD_PROVIDER: DWORD = 1204; -pub const ERROR_CANNOT_OPEN_PROFILE: DWORD = 1205; -pub const ERROR_BAD_PROFILE: DWORD = 1206; -pub const ERROR_NOT_CONTAINER: DWORD = 1207; -pub const ERROR_EXTENDED_ERROR: DWORD = 1208; -pub const ERROR_INVALID_GROUPNAME: DWORD = 1209; -pub const ERROR_INVALID_COMPUTERNAME: DWORD = 1210; -pub const ERROR_INVALID_EVENTNAME: DWORD = 1211; -pub const ERROR_INVALID_DOMAINNAME: DWORD = 1212; -pub const ERROR_INVALID_SERVICENAME: DWORD = 1213; -pub const ERROR_INVALID_NETNAME: DWORD = 1214; -pub const ERROR_INVALID_SHARENAME: DWORD = 1215; -pub const ERROR_INVALID_PASSWORDNAME: DWORD = 1216; -pub const ERROR_INVALID_MESSAGENAME: DWORD = 1217; -pub const ERROR_INVALID_MESSAGEDEST: DWORD = 1218; -pub const ERROR_SESSION_CREDENTIAL_CONFLICT: DWORD = 1219; -pub const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED: DWORD = 1220; -pub const ERROR_DUP_DOMAINNAME: DWORD = 1221; -pub const ERROR_NO_NETWORK: DWORD = 1222; -pub const ERROR_CANCELLED: DWORD = 1223; -pub const ERROR_USER_MAPPED_FILE: DWORD = 1224; -pub const ERROR_CONNECTION_REFUSED: DWORD = 1225; -pub const ERROR_GRACEFUL_DISCONNECT: DWORD = 1226; -pub const ERROR_ADDRESS_ALREADY_ASSOCIATED: DWORD = 1227; -pub const ERROR_ADDRESS_NOT_ASSOCIATED: DWORD = 1228; -pub const ERROR_CONNECTION_INVALID: DWORD = 1229; -pub const ERROR_CONNECTION_ACTIVE: DWORD = 1230; -pub const ERROR_NETWORK_UNREACHABLE: DWORD = 1231; -pub const ERROR_HOST_UNREACHABLE: DWORD = 1232; -pub const ERROR_PROTOCOL_UNREACHABLE: DWORD = 1233; -pub const ERROR_PORT_UNREACHABLE: DWORD = 1234; -pub const ERROR_REQUEST_ABORTED: DWORD = 1235; -pub const ERROR_CONNECTION_ABORTED: DWORD = 1236; -pub const ERROR_RETRY: DWORD = 1237; -pub const ERROR_CONNECTION_COUNT_LIMIT: DWORD = 1238; -pub const ERROR_LOGIN_TIME_RESTRICTION: DWORD = 1239; -pub const ERROR_LOGIN_WKSTA_RESTRICTION: DWORD = 1240; -pub const ERROR_INCORRECT_ADDRESS: DWORD = 1241; -pub const ERROR_ALREADY_REGISTERED: DWORD = 1242; -pub const ERROR_SERVICE_NOT_FOUND: DWORD = 1243; -pub const ERROR_NOT_AUTHENTICATED: DWORD = 1244; -pub const ERROR_NOT_LOGGED_ON: DWORD = 1245; -pub const ERROR_CONTINUE: DWORD = 1246; -pub const ERROR_ALREADY_INITIALIZED: DWORD = 1247; -pub const ERROR_NO_MORE_DEVICES: DWORD = 1248; -pub const ERROR_NO_SUCH_SITE: DWORD = 1249; -pub const ERROR_DOMAIN_CONTROLLER_EXISTS: DWORD = 1250; -pub const ERROR_ONLY_IF_CONNECTED: DWORD = 1251; -pub const ERROR_OVERRIDE_NOCHANGES: DWORD = 1252; -pub const ERROR_BAD_USER_PROFILE: DWORD = 1253; -pub const ERROR_NOT_SUPPORTED_ON_SBS: DWORD = 1254; -pub const ERROR_SERVER_SHUTDOWN_IN_PROGRESS: DWORD = 1255; -pub const ERROR_HOST_DOWN: DWORD = 1256; -pub const ERROR_NON_ACCOUNT_SID: DWORD = 1257; -pub const ERROR_NON_DOMAIN_SID: DWORD = 1258; -pub const ERROR_APPHELP_BLOCK: DWORD = 1259; -pub const ERROR_ACCESS_DISABLED_BY_POLICY: DWORD = 1260; -pub const ERROR_REG_NAT_CONSUMPTION: DWORD = 1261; -pub const ERROR_CSCSHARE_OFFLINE: DWORD = 1262; -pub const ERROR_PKINIT_FAILURE: DWORD = 1263; -pub const ERROR_SMARTCARD_SUBSYSTEM_FAILURE: DWORD = 1264; -pub const ERROR_DOWNGRADE_DETECTED: DWORD = 1265; -pub const ERROR_MACHINE_LOCKED: DWORD = 1271; -pub const ERROR_CALLBACK_SUPPLIED_INVALID_DATA: DWORD = 1273; -pub const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED: DWORD = 1274; -pub const ERROR_DRIVER_BLOCKED: DWORD = 1275; -pub const ERROR_INVALID_IMPORT_OF_NON_DLL: DWORD = 1276; -pub const ERROR_ACCESS_DISABLED_WEBBLADE: DWORD = 1277; -pub const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER: DWORD = 1278; -pub const ERROR_RECOVERY_FAILURE: DWORD = 1279; -pub const ERROR_ALREADY_FIBER: DWORD = 1280; -pub const ERROR_ALREADY_THREAD: DWORD = 1281; -pub const ERROR_STACK_BUFFER_OVERRUN: DWORD = 1282; -pub const ERROR_PARAMETER_QUOTA_EXCEEDED: DWORD = 1283; -pub const ERROR_DEBUGGER_INACTIVE: DWORD = 1284; -pub const ERROR_DELAY_LOAD_FAILED: DWORD = 1285; -pub const ERROR_VDM_DISALLOWED: DWORD = 1286; -pub const ERROR_UNIDENTIFIED_ERROR: DWORD = 1287; -pub const ERROR_NOT_ALL_ASSIGNED: DWORD = 1300; -pub const ERROR_SOME_NOT_MAPPED: DWORD = 1301; -pub const ERROR_NO_QUOTAS_FOR_ACCOUNT: DWORD = 1302; -pub const ERROR_LOCAL_USER_SESSION_KEY: DWORD = 1303; -pub const ERROR_NULL_LM_PASSWORD: DWORD = 1304; -pub const ERROR_UNKNOWN_REVISION: DWORD = 1305; -pub const ERROR_REVISION_MISMATCH: DWORD = 1306; -pub const ERROR_INVALID_OWNER: DWORD = 1307; -pub const ERROR_INVALID_PRIMARY_GROUP: DWORD = 1308; -pub const ERROR_NO_IMPERSONATION_TOKEN: DWORD = 1309; -pub const ERROR_CANT_DISABLE_MANDATORY: DWORD = 1310; -pub const ERROR_NO_LOGON_SERVERS: DWORD = 1311; -pub const ERROR_NO_SUCH_LOGON_SESSION: DWORD = 1312; -pub const ERROR_NO_SUCH_PRIVILEGE: DWORD = 1313; -pub const ERROR_PRIVILEGE_NOT_HELD: DWORD = 1314; -pub const ERROR_INVALID_ACCOUNT_NAME: DWORD = 1315; -pub const ERROR_USER_EXISTS: DWORD = 1316; -pub const ERROR_NO_SUCH_USER: DWORD = 1317; -pub const ERROR_GROUP_EXISTS: DWORD = 1318; -pub const ERROR_NO_SUCH_GROUP: DWORD = 1319; -pub const ERROR_MEMBER_IN_GROUP: DWORD = 1320; -pub const ERROR_MEMBER_NOT_IN_GROUP: DWORD = 1321; -pub const ERROR_LAST_ADMIN: DWORD = 1322; -pub const ERROR_WRONG_PASSWORD: DWORD = 1323; -pub const ERROR_ILL_FORMED_PASSWORD: DWORD = 1324; -pub const ERROR_PASSWORD_RESTRICTION: DWORD = 1325; -pub const ERROR_LOGON_FAILURE: DWORD = 1326; -pub const ERROR_ACCOUNT_RESTRICTION: DWORD = 1327; -pub const ERROR_INVALID_LOGON_HOURS: DWORD = 1328; -pub const ERROR_INVALID_WORKSTATION: DWORD = 1329; -pub const ERROR_PASSWORD_EXPIRED: DWORD = 1330; -pub const ERROR_ACCOUNT_DISABLED: DWORD = 1331; -pub const ERROR_NONE_MAPPED: DWORD = 1332; -pub const ERROR_TOO_MANY_LUIDS_REQUESTED: DWORD = 1333; -pub const ERROR_LUIDS_EXHAUSTED: DWORD = 1334; -pub const ERROR_INVALID_SUB_AUTHORITY: DWORD = 1335; -pub const ERROR_INVALID_ACL: DWORD = 1336; -pub const ERROR_INVALID_SID: DWORD = 1337; -pub const ERROR_INVALID_SECURITY_DESCR: DWORD = 1338; -pub const ERROR_BAD_INHERITANCE_ACL: DWORD = 1340; -pub const ERROR_SERVER_DISABLED: DWORD = 1341; -pub const ERROR_SERVER_NOT_DISABLED: DWORD = 1342; -pub const ERROR_INVALID_ID_AUTHORITY: DWORD = 1343; -pub const ERROR_ALLOTTED_SPACE_EXCEEDED: DWORD = 1344; -pub const ERROR_INVALID_GROUP_ATTRIBUTES: DWORD = 1345; -pub const ERROR_BAD_IMPERSONATION_LEVEL: DWORD = 1346; -pub const ERROR_CANT_OPEN_ANONYMOUS: DWORD = 1347; -pub const ERROR_BAD_VALIDATION_CLASS: DWORD = 1348; -pub const ERROR_BAD_TOKEN_TYPE: DWORD = 1349; -pub const ERROR_NO_SECURITY_ON_OBJECT: DWORD = 1350; -pub const ERROR_CANT_ACCESS_DOMAIN_INFO: DWORD = 1351; -pub const ERROR_INVALID_SERVER_STATE: DWORD = 1352; -pub const ERROR_INVALID_DOMAIN_STATE: DWORD = 1353; -pub const ERROR_INVALID_DOMAIN_ROLE: DWORD = 1354; -pub const ERROR_NO_SUCH_DOMAIN: DWORD = 1355; -pub const ERROR_DOMAIN_EXISTS: DWORD = 1356; -pub const ERROR_DOMAIN_LIMIT_EXCEEDED: DWORD = 1357; -pub const ERROR_INTERNAL_DB_CORRUPTION: DWORD = 1358; -pub const ERROR_INTERNAL_ERROR: DWORD = 1359; -pub const ERROR_GENERIC_NOT_MAPPED: DWORD = 1360; -pub const ERROR_BAD_DESCRIPTOR_FORMAT: DWORD = 1361; -pub const ERROR_NOT_LOGON_PROCESS: DWORD = 1362; -pub const ERROR_LOGON_SESSION_EXISTS: DWORD = 1363; -pub const ERROR_NO_SUCH_PACKAGE: DWORD = 1364; -pub const ERROR_BAD_LOGON_SESSION_STATE: DWORD = 1365; -pub const ERROR_LOGON_SESSION_COLLISION: DWORD = 1366; -pub const ERROR_INVALID_LOGON_TYPE: DWORD = 1367; -pub const ERROR_CANNOT_IMPERSONATE: DWORD = 1368; -pub const ERROR_RXACT_INVALID_STATE: DWORD = 1369; -pub const ERROR_RXACT_COMMIT_FAILURE: DWORD = 1370; -pub const ERROR_SPECIAL_ACCOUNT: DWORD = 1371; -pub const ERROR_SPECIAL_GROUP: DWORD = 1372; -pub const ERROR_SPECIAL_USER: DWORD = 1373; -pub const ERROR_MEMBERS_PRIMARY_GROUP: DWORD = 1374; -pub const ERROR_TOKEN_ALREADY_IN_USE: DWORD = 1375; -pub const ERROR_NO_SUCH_ALIAS: DWORD = 1376; -pub const ERROR_MEMBER_NOT_IN_ALIAS: DWORD = 1377; -pub const ERROR_MEMBER_IN_ALIAS: DWORD = 1378; -pub const ERROR_ALIAS_EXISTS: DWORD = 1379; -pub const ERROR_LOGON_NOT_GRANTED: DWORD = 1380; -pub const ERROR_TOO_MANY_SECRETS: DWORD = 1381; -pub const ERROR_SECRET_TOO_LONG: DWORD = 1382; -pub const ERROR_INTERNAL_DB_ERROR: DWORD = 1383; -pub const ERROR_TOO_MANY_CONTEXT_IDS: DWORD = 1384; -pub const ERROR_LOGON_TYPE_NOT_GRANTED: DWORD = 1385; -pub const ERROR_NT_CROSS_ENCRYPTION_REQUIRED: DWORD = 1386; -pub const ERROR_NO_SUCH_MEMBER: DWORD = 1387; -pub const ERROR_INVALID_MEMBER: DWORD = 1388; -pub const ERROR_TOO_MANY_SIDS: DWORD = 1389; -pub const ERROR_LM_CROSS_ENCRYPTION_REQUIRED: DWORD = 1390; -pub const ERROR_NO_INHERITANCE: DWORD = 1391; -pub const ERROR_FILE_CORRUPT: DWORD = 1392; -pub const ERROR_DISK_CORRUPT: DWORD = 1393; -pub const ERROR_NO_USER_SESSION_KEY: DWORD = 1394; -pub const ERROR_LICENSE_QUOTA_EXCEEDED: DWORD = 1395; -pub const ERROR_WRONG_TARGET_NAME: DWORD = 1396; -pub const ERROR_MUTUAL_AUTH_FAILED: DWORD = 1397; -pub const ERROR_TIME_SKEW: DWORD = 1398; -pub const ERROR_CURRENT_DOMAIN_NOT_ALLOWED: DWORD = 1399; -pub const ERROR_INVALID_WINDOW_HANDLE: DWORD = 1400; -pub const ERROR_INVALID_MENU_HANDLE: DWORD = 1401; -pub const ERROR_INVALID_CURSOR_HANDLE: DWORD = 1402; -pub const ERROR_INVALID_ACCEL_HANDLE: DWORD = 1403; -pub const ERROR_INVALID_HOOK_HANDLE: DWORD = 1404; -pub const ERROR_INVALID_DWP_HANDLE: DWORD = 1405; -pub const ERROR_TLW_WITH_WSCHILD: DWORD = 1406; -pub const ERROR_CANNOT_FIND_WND_CLASS: DWORD = 1407; -pub const ERROR_WINDOW_OF_OTHER_THREAD: DWORD = 1408; -pub const ERROR_HOTKEY_ALREADY_REGISTERED: DWORD = 1409; -pub const ERROR_CLASS_ALREADY_EXISTS: DWORD = 1410; -pub const ERROR_CLASS_DOES_NOT_EXIST: DWORD = 1411; -pub const ERROR_CLASS_HAS_WINDOWS: DWORD = 1412; -pub const ERROR_INVALID_INDEX: DWORD = 1413; -pub const ERROR_INVALID_ICON_HANDLE: DWORD = 1414; -pub const ERROR_PRIVATE_DIALOG_INDEX: DWORD = 1415; -pub const ERROR_LISTBOX_ID_NOT_FOUND: DWORD = 1416; -pub const ERROR_NO_WILDCARD_CHARACTERS: DWORD = 1417; -pub const ERROR_CLIPBOARD_NOT_OPEN: DWORD = 1418; -pub const ERROR_HOTKEY_NOT_REGISTERED: DWORD = 1419; -pub const ERROR_WINDOW_NOT_DIALOG: DWORD = 1420; -pub const ERROR_CONTROL_ID_NOT_FOUND: DWORD = 1421; -pub const ERROR_INVALID_COMBOBOX_MESSAGE: DWORD = 1422; -pub const ERROR_WINDOW_NOT_COMBOBOX: DWORD = 1423; -pub const ERROR_INVALID_EDIT_HEIGHT: DWORD = 1424; -pub const ERROR_DC_NOT_FOUND: DWORD = 1425; -pub const ERROR_INVALID_HOOK_FILTER: DWORD = 1426; -pub const ERROR_INVALID_FILTER_PROC: DWORD = 1427; -pub const ERROR_HOOK_NEEDS_HMOD: DWORD = 1428; -pub const ERROR_GLOBAL_ONLY_HOOK: DWORD = 1429; -pub const ERROR_JOURNAL_HOOK_SET: DWORD = 1430; -pub const ERROR_HOOK_NOT_INSTALLED: DWORD = 1431; -pub const ERROR_INVALID_LB_MESSAGE: DWORD = 1432; -pub const ERROR_SETCOUNT_ON_BAD_LB: DWORD = 1433; -pub const ERROR_LB_WITHOUT_TABSTOPS: DWORD = 1434; -pub const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD: DWORD = 1435; -pub const ERROR_CHILD_WINDOW_MENU: DWORD = 1436; -pub const ERROR_NO_SYSTEM_MENU: DWORD = 1437; -pub const ERROR_INVALID_MSGBOX_STYLE: DWORD = 1438; -pub const ERROR_INVALID_SPI_VALUE: DWORD = 1439; -pub const ERROR_SCREEN_ALREADY_LOCKED: DWORD = 1440; -pub const ERROR_HWNDS_HAVE_DIFF_PARENT: DWORD = 1441; -pub const ERROR_NOT_CHILD_WINDOW: DWORD = 1442; -pub const ERROR_INVALID_GW_COMMAND: DWORD = 1443; -pub const ERROR_INVALID_THREAD_ID: DWORD = 1444; -pub const ERROR_NON_MDICHILD_WINDOW: DWORD = 1445; -pub const ERROR_POPUP_ALREADY_ACTIVE: DWORD = 1446; -pub const ERROR_NO_SCROLLBARS: DWORD = 1447; -pub const ERROR_INVALID_SCROLLBAR_RANGE: DWORD = 1448; -pub const ERROR_INVALID_SHOWWIN_COMMAND: DWORD = 1449; -pub const ERROR_NO_SYSTEM_RESOURCES: DWORD = 1450; -pub const ERROR_NONPAGED_SYSTEM_RESOURCES: DWORD = 1451; -pub const ERROR_PAGED_SYSTEM_RESOURCES: DWORD = 1452; -pub const ERROR_WORKING_SET_QUOTA: DWORD = 1453; -pub const ERROR_PAGEFILE_QUOTA: DWORD = 1454; -pub const ERROR_COMMITMENT_LIMIT: DWORD = 1455; -pub const ERROR_MENU_ITEM_NOT_FOUND: DWORD = 1456; -pub const ERROR_INVALID_KEYBOARD_HANDLE: DWORD = 1457; -pub const ERROR_HOOK_TYPE_NOT_ALLOWED: DWORD = 1458; -pub const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION: DWORD = 1459; -pub const ERROR_TIMEOUT: DWORD = 1460; -pub const ERROR_INVALID_MONITOR_HANDLE: DWORD = 1461; -pub const ERROR_INCORRECT_SIZE: DWORD = 1462; -pub const ERROR_SYMLINK_CLASS_DISABLED: DWORD = 1463; -pub const ERROR_SYMLINK_NOT_SUPPORTED: DWORD = 1464; -pub const ERROR_XML_PARSE_ERROR: DWORD = 1465; -pub const ERROR_XMLDSIG_ERROR: DWORD = 1466; -pub const ERROR_RESTART_APPLICATION: DWORD = 1467; -pub const ERROR_WRONG_COMPARTMENT: DWORD = 1468; -pub const ERROR_AUTHIP_FAILURE: DWORD = 1469; -pub const ERROR_NO_NVRAM_RESOURCES: DWORD = 1470; -pub const ERROR_NOT_GUI_PROCESS: DWORD = 1471; -pub const ERROR_EVENTLOG_FILE_CORRUPT: DWORD = 1500; -pub const ERROR_EVENTLOG_CANT_START: DWORD = 1501; -pub const ERROR_LOG_FILE_FULL: DWORD = 1502; -pub const ERROR_EVENTLOG_FILE_CHANGED: DWORD = 1503; -pub const ERROR_INSTALL_SERVICE_FAILURE: DWORD = 1601; -pub const ERROR_INSTALL_USEREXIT: DWORD = 1602; -pub const ERROR_INSTALL_FAILURE: DWORD = 1603; -pub const ERROR_INSTALL_SUSPEND: DWORD = 1604; -pub const ERROR_UNKNOWN_PRODUCT: DWORD = 1605; -pub const ERROR_UNKNOWN_FEATURE: DWORD = 1606; -pub const ERROR_UNKNOWN_COMPONENT: DWORD = 1607; -pub const ERROR_UNKNOWN_PROPERTY: DWORD = 1608; -pub const ERROR_INVALID_HANDLE_STATE: DWORD = 1609; -pub const ERROR_BAD_CONFIGURATION: DWORD = 1610; -pub const ERROR_INDEX_ABSENT: DWORD = 1611; -pub const ERROR_INSTALL_SOURCE_ABSENT: DWORD = 1612; -pub const ERROR_INSTALL_PACKAGE_VERSION: DWORD = 1613; -pub const ERROR_PRODUCT_UNINSTALLED: DWORD = 1614; -pub const ERROR_BAD_QUERY_SYNTAX: DWORD = 1615; -pub const ERROR_INVALID_FIELD: DWORD = 1616; -pub const ERROR_DEVICE_REMOVED: DWORD = 1617; -pub const ERROR_INSTALL_ALREADY_RUNNING: DWORD = 1618; -pub const ERROR_INSTALL_PACKAGE_OPEN_FAILED: DWORD = 1619; -pub const ERROR_INSTALL_PACKAGE_INVALID: DWORD = 1620; -pub const ERROR_INSTALL_UI_FAILURE: DWORD = 1621; -pub const ERROR_INSTALL_LOG_FAILURE: DWORD = 1622; -pub const ERROR_INSTALL_LANGUAGE_UNSUPPORTED: DWORD = 1623; -pub const ERROR_INSTALL_TRANSFORM_FAILURE: DWORD = 1624; -pub const ERROR_INSTALL_PACKAGE_REJECTED: DWORD = 1625; -pub const ERROR_FUNCTION_NOT_CALLED: DWORD = 1626; -pub const ERROR_FUNCTION_FAILED: DWORD = 1627; -pub const ERROR_INVALID_TABLE: DWORD = 1628; -pub const ERROR_DATATYPE_MISMATCH: DWORD = 1629; -pub const ERROR_UNSUPPORTED_TYPE: DWORD = 1630; -pub const ERROR_CREATE_FAILED: DWORD = 1631; -pub const ERROR_INSTALL_TEMP_UNWRITABLE: DWORD = 1632; -pub const ERROR_INSTALL_PLATFORM_UNSUPPORTED: DWORD = 1633; -pub const ERROR_INSTALL_NOTUSED: DWORD = 1634; -pub const ERROR_PATCH_PACKAGE_OPEN_FAILED: DWORD = 1635; -pub const ERROR_PATCH_PACKAGE_INVALID: DWORD = 1636; -pub const ERROR_PATCH_PACKAGE_UNSUPPORTED: DWORD = 1637; -pub const ERROR_PRODUCT_VERSION: DWORD = 1638; -pub const ERROR_INVALID_COMMAND_LINE: DWORD = 1639; -pub const ERROR_INSTALL_REMOTE_DISALLOWED: DWORD = 1640; -pub const ERROR_SUCCESS_REBOOT_INITIATED: DWORD = 1641; -pub const ERROR_PATCH_TARGET_NOT_FOUND: DWORD = 1642; -pub const ERROR_PATCH_PACKAGE_REJECTED: DWORD = 1643; -pub const ERROR_INSTALL_TRANSFORM_REJECTED: DWORD = 1644; -pub const ERROR_INSTALL_REMOTE_PROHIBITED: DWORD = 1645; -pub const ERROR_INVALID_USER_BUFFER: DWORD = 1784; -pub const ERROR_UNRECOGNIZED_MEDIA: DWORD = 1785; -pub const ERROR_NO_TRUST_LSA_SECRET: DWORD = 1786; -pub const ERROR_NO_TRUST_SAM_ACCOUNT: DWORD = 1787; -pub const ERROR_TRUSTED_DOMAIN_FAILURE: DWORD = 1788; -pub const ERROR_TRUSTED_RELATIONSHIP_FAILURE: DWORD = 1789; -pub const ERROR_TRUST_FAILURE: DWORD = 1790; -pub const ERROR_NETLOGON_NOT_STARTED: DWORD = 1792; -pub const ERROR_ACCOUNT_EXPIRED: DWORD = 1793; -pub const ERROR_REDIRECTOR_HAS_OPEN_HANDLES: DWORD = 1794; -pub const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED: DWORD = 1795; -pub const ERROR_UNKNOWN_PORT: DWORD = 1796; -pub const ERROR_UNKNOWN_PRINTER_DRIVER: DWORD = 1797; -pub const ERROR_UNKNOWN_PRINTPROCESSOR: DWORD = 1798; -pub const ERROR_INVALID_SEPARATOR_FILE: DWORD = 1799; -pub const ERROR_INVALID_PRIORITY: DWORD = 1800; -pub const ERROR_INVALID_PRINTER_NAME: DWORD = 1801; -pub const ERROR_PRINTER_ALREADY_EXISTS: DWORD = 1802; -pub const ERROR_INVALID_PRINTER_COMMAND: DWORD = 1803; -pub const ERROR_INVALID_DATATYPE: DWORD = 1804; -pub const ERROR_INVALID_ENVIRONMENT: DWORD = 1805; -pub const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: DWORD = 1807; -pub const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT: DWORD = 1808; -pub const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT: DWORD = 1809; -pub const ERROR_DOMAIN_TRUST_INCONSISTENT: DWORD = 1810; -pub const ERROR_SERVER_HAS_OPEN_HANDLES: DWORD = 1811; -pub const ERROR_RESOURCE_DATA_NOT_FOUND: DWORD = 1812; -pub const ERROR_RESOURCE_TYPE_NOT_FOUND: DWORD = 1813; -pub const ERROR_RESOURCE_NAME_NOT_FOUND: DWORD = 1814; -pub const ERROR_RESOURCE_LANG_NOT_FOUND: DWORD = 1815; -pub const ERROR_NOT_ENOUGH_QUOTA: DWORD = 1816; -pub const ERROR_INVALID_TIME: DWORD = 1901; -pub const ERROR_INVALID_FORM_NAME: DWORD = 1902; -pub const ERROR_INVALID_FORM_SIZE: DWORD = 1903; -pub const ERROR_ALREADY_WAITING: DWORD = 1904; -pub const ERROR_PRINTER_DELETED: DWORD = 1905; -pub const ERROR_INVALID_PRINTER_STATE: DWORD = 1906; -pub const ERROR_PASSWORD_MUST_CHANGE: DWORD = 1907; -pub const ERROR_DOMAIN_CONTROLLER_NOT_FOUND: DWORD = 1908; -pub const ERROR_ACCOUNT_LOCKED_OUT: DWORD = 1909; -pub const ERROR_NO_SITENAME: DWORD = 1919; -pub const ERROR_CANT_ACCESS_FILE: DWORD = 1920; -pub const ERROR_CANT_RESOLVE_FILENAME: DWORD = 1921; -pub const ERROR_KM_DRIVER_BLOCKED: DWORD = 1930; -pub const ERROR_CONTEXT_EXPIRED: DWORD = 1931; -pub const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED: DWORD = 1932; -pub const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED: DWORD = 1933; -pub const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED: DWORD = 1934; -pub const ERROR_AUTHENTICATION_FIREWALL_FAILED: DWORD = 1935; -pub const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED: DWORD = 1936; -pub const ERROR_INVALID_PIXEL_FORMAT: DWORD = 2000; -pub const ERROR_BAD_DRIVER: DWORD = 2001; -pub const ERROR_INVALID_WINDOW_STYLE: DWORD = 2002; -pub const ERROR_METAFILE_NOT_SUPPORTED: DWORD = 2003; -pub const ERROR_TRANSFORM_NOT_SUPPORTED: DWORD = 2004; -pub const ERROR_CLIPPING_NOT_SUPPORTED: DWORD = 2005; -pub const ERROR_INVALID_CMM: DWORD = 2010; -pub const ERROR_INVALID_PROFILE: DWORD = 2011; -pub const ERROR_TAG_NOT_FOUND: DWORD = 2012; -pub const ERROR_TAG_NOT_PRESENT: DWORD = 2013; -pub const ERROR_DUPLICATE_TAG: DWORD = 2014; -pub const ERROR_PROFILE_NOT_ASSOCIATED_WITH_DEVICE: DWORD = 2015; -pub const ERROR_PROFILE_NOT_FOUND: DWORD = 2016; -pub const ERROR_INVALID_COLORSPACE: DWORD = 2017; -pub const ERROR_ICM_NOT_ENABLED: DWORD = 2018; -pub const ERROR_DELETING_ICM_XFORM: DWORD = 2019; -pub const ERROR_INVALID_TRANSFORM: DWORD = 2020; -pub const ERROR_COLORSPACE_MISMATCH: DWORD = 2021; -pub const ERROR_INVALID_COLORINDEX: DWORD = 2022; -pub const ERROR_CONNECTED_OTHER_PASSWORD: DWORD = 2108; -pub const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT: DWORD = 2109; -pub const ERROR_BAD_USERNAME: DWORD = 2202; -pub const ERROR_NOT_CONNECTED: DWORD = 2250; -pub const ERROR_OPEN_FILES: DWORD = 2401; -pub const ERROR_ACTIVE_CONNECTIONS: DWORD = 2402; -pub const ERROR_DEVICE_IN_USE: DWORD = 2404; -pub const ERROR_UNKNOWN_PRINT_MONITOR: DWORD = 3000; -pub const ERROR_PRINTER_DRIVER_IN_USE: DWORD = 3001; -pub const ERROR_SPOOL_FILE_NOT_FOUND: DWORD = 3002; -pub const ERROR_SPL_NO_STARTDOC: DWORD = 3003; -pub const ERROR_SPL_NO_ADDJOB: DWORD = 3004; -pub const ERROR_PRINT_PROCESSOR_ALREADY_INSTALLED: DWORD = 3005; -pub const ERROR_PRINT_MONITOR_ALREADY_INSTALLED: DWORD = 3006; -pub const ERROR_INVALID_PRINT_MONITOR: DWORD = 3007; -pub const ERROR_PRINT_MONITOR_IN_USE: DWORD = 3008; -pub const ERROR_PRINTER_HAS_JOBS_QUEUED: DWORD = 3009; -pub const ERROR_SUCCESS_REBOOT_REQUIRED: DWORD = 3010; -pub const ERROR_SUCCESS_RESTART_REQUIRED: DWORD = 3011; -pub const ERROR_PRINTER_NOT_FOUND: DWORD = 3012; -pub const ERROR_PRINTER_DRIVER_WARNED: DWORD = 3013; -pub const ERROR_PRINTER_DRIVER_BLOCKED: DWORD = 3014; -pub const ERROR_WINS_INTERNAL: DWORD = 4000; -pub const ERROR_CAN_NOT_DEL_LOCAL_WINS: DWORD = 4001; -pub const ERROR_STATIC_INIT: DWORD = 4002; -pub const ERROR_INC_BACKUP: DWORD = 4003; -pub const ERROR_FULL_BACKUP: DWORD = 4004; -pub const ERROR_REC_NON_EXISTENT: DWORD = 4005; -pub const ERROR_RPL_NOT_ALLOWED: DWORD = 4006; -pub const ERROR_DHCP_ADDRESS_CONFLICT: DWORD = 4100; -pub const ERROR_WMI_GUID_NOT_FOUND: DWORD = 4200; -pub const ERROR_WMI_INSTANCE_NOT_FOUND: DWORD = 4201; -pub const ERROR_WMI_ITEMID_NOT_FOUND: DWORD = 4202; -pub const ERROR_WMI_TRY_AGAIN: DWORD = 4203; -pub const ERROR_WMI_DP_NOT_FOUND: DWORD = 4204; -pub const ERROR_WMI_UNRESOLVED_INSTANCE_REF: DWORD = 4205; -pub const ERROR_WMI_ALREADY_ENABLED: DWORD = 4206; -pub const ERROR_WMI_GUID_DISCONNECTED: DWORD = 4207; -pub const ERROR_WMI_SERVER_UNAVAILABLE: DWORD = 4208; -pub const ERROR_WMI_DP_FAILED: DWORD = 4209; -pub const ERROR_WMI_INVALID_MOF: DWORD = 4210; -pub const ERROR_WMI_INVALID_REGINFO: DWORD = 4211; -pub const ERROR_WMI_ALREADY_DISABLED: DWORD = 4212; -pub const ERROR_WMI_READ_ONLY: DWORD = 4213; -pub const ERROR_WMI_SET_FAILURE: DWORD = 4214; -pub const ERROR_INVALID_MEDIA: DWORD = 4300; -pub const ERROR_INVALID_LIBRARY: DWORD = 4301; -pub const ERROR_INVALID_MEDIA_POOL: DWORD = 4302; -pub const ERROR_DRIVE_MEDIA_MISMATCH: DWORD = 4303; -pub const ERROR_MEDIA_OFFLINE: DWORD = 4304; -pub const ERROR_LIBRARY_OFFLINE: DWORD = 4305; -pub const ERROR_EMPTY: DWORD = 4306; -pub const ERROR_NOT_EMPTY: DWORD = 4307; -pub const ERROR_MEDIA_UNAVAILABLE: DWORD = 4308; -pub const ERROR_RESOURCE_DISABLED: DWORD = 4309; -pub const ERROR_INVALID_CLEANER: DWORD = 4310; -pub const ERROR_UNABLE_TO_CLEAN: DWORD = 4311; -pub const ERROR_OBJECT_NOT_FOUND: DWORD = 4312; -pub const ERROR_DATABASE_FAILURE: DWORD = 4313; -pub const ERROR_DATABASE_FULL: DWORD = 4314; -pub const ERROR_MEDIA_INCOMPATIBLE: DWORD = 4315; -pub const ERROR_RESOURCE_NOT_PRESENT: DWORD = 4316; -pub const ERROR_INVALID_OPERATION: DWORD = 4317; -pub const ERROR_MEDIA_NOT_AVAILABLE: DWORD = 4318; -pub const ERROR_DEVICE_NOT_AVAILABLE: DWORD = 4319; -pub const ERROR_REQUEST_REFUSED: DWORD = 4320; -pub const ERROR_INVALID_DRIVE_OBJECT: DWORD = 4321; -pub const ERROR_LIBRARY_FULL: DWORD = 4322; -pub const ERROR_MEDIUM_NOT_ACCESSIBLE: DWORD = 4323; -pub const ERROR_UNABLE_TO_LOAD_MEDIUM: DWORD = 4324; -pub const ERROR_UNABLE_TO_INVENTORY_DRIVE: DWORD = 4325; -pub const ERROR_UNABLE_TO_INVENTORY_SLOT: DWORD = 4326; -pub const ERROR_UNABLE_TO_INVENTORY_TRANSPORT: DWORD = 4327; -pub const ERROR_TRANSPORT_FULL: DWORD = 4328; -pub const ERROR_CONTROLLING_IEPORT: DWORD = 4329; -pub const ERROR_UNABLE_TO_EJECT_MOUNTED_MEDIA: DWORD = 4330; -pub const ERROR_CLEANER_SLOT_SET: DWORD = 4331; -pub const ERROR_CLEANER_SLOT_NOT_SET: DWORD = 4332; -pub const ERROR_CLEANER_CARTRIDGE_SPENT: DWORD = 4333; -pub const ERROR_UNEXPECTED_OMID: DWORD = 4334; -pub const ERROR_CANT_DELETE_LAST_ITEM: DWORD = 4335; -pub const ERROR_MESSAGE_EXCEEDS_MAX_SIZE: DWORD = 4336; -pub const ERROR_VOLUME_CONTAINS_SYS_FILES: DWORD = 4337; -pub const ERROR_INDIGENOUS_TYPE: DWORD = 4338; -pub const ERROR_NO_SUPPORTING_DRIVES: DWORD = 4339; -pub const ERROR_CLEANER_CARTRIDGE_INSTALLED: DWORD = 4340; -pub const ERROR_IEPORT_FULL: DWORD = 4341; -pub const ERROR_FILE_OFFLINE: DWORD = 4350; -pub const ERROR_REMOTE_STORAGE_NOT_ACTIVE: DWORD = 4351; -pub const ERROR_REMOTE_STORAGE_MEDIA_ERROR: DWORD = 4352; -pub const ERROR_NOT_A_REPARSE_POINT: DWORD = 4390; -pub const ERROR_REPARSE_ATTRIBUTE_CONFLICT: DWORD = 4391; -pub const ERROR_INVALID_REPARSE_DATA: DWORD = 4392; -pub const ERROR_REPARSE_TAG_INVALID: DWORD = 4393; -pub const ERROR_REPARSE_TAG_MISMATCH: DWORD = 4394; -pub const ERROR_VOLUME_NOT_SIS_ENABLED: DWORD = 4500; -pub const ERROR_DEPENDENT_RESOURCE_EXISTS: DWORD = 5001; -pub const ERROR_DEPENDENCY_NOT_FOUND: DWORD = 5002; -pub const ERROR_DEPENDENCY_ALREADY_EXISTS: DWORD = 5003; -pub const ERROR_RESOURCE_NOT_ONLINE: DWORD = 5004; -pub const ERROR_HOST_NODE_NOT_AVAILABLE: DWORD = 5005; -pub const ERROR_RESOURCE_NOT_AVAILABLE: DWORD = 5006; -pub const ERROR_RESOURCE_NOT_FOUND: DWORD = 5007; -pub const ERROR_SHUTDOWN_CLUSTER: DWORD = 5008; -pub const ERROR_CANT_EVICT_ACTIVE_NODE: DWORD = 5009; -pub const ERROR_OBJECT_ALREADY_EXISTS: DWORD = 5010; -pub const ERROR_OBJECT_IN_LIST: DWORD = 5011; -pub const ERROR_GROUP_NOT_AVAILABLE: DWORD = 5012; -pub const ERROR_GROUP_NOT_FOUND: DWORD = 5013; -pub const ERROR_GROUP_NOT_ONLINE: DWORD = 5014; -pub const ERROR_HOST_NODE_NOT_RESOURCE_OWNER: DWORD = 5015; -pub const ERROR_HOST_NODE_NOT_GROUP_OWNER: DWORD = 5016; -pub const ERROR_RESMON_CREATE_FAILED: DWORD = 5017; -pub const ERROR_RESMON_ONLINE_FAILED: DWORD = 5018; -pub const ERROR_RESOURCE_ONLINE: DWORD = 5019; -pub const ERROR_QUORUM_RESOURCE: DWORD = 5020; -pub const ERROR_NOT_QUORUM_CAPABLE: DWORD = 5021; -pub const ERROR_CLUSTER_SHUTTING_DOWN: DWORD = 5022; -pub const ERROR_INVALID_STATE: DWORD = 5023; -pub const ERROR_RESOURCE_PROPERTIES_STORED: DWORD = 5024; -pub const ERROR_NOT_QUORUM_CLASS: DWORD = 5025; -pub const ERROR_CORE_RESOURCE: DWORD = 5026; -pub const ERROR_QUORUM_RESOURCE_ONLINE_FAILED: DWORD = 5027; -pub const ERROR_QUORUMLOG_OPEN_FAILED: DWORD = 5028; -pub const ERROR_CLUSTERLOG_CORRUPT: DWORD = 5029; -pub const ERROR_CLUSTERLOG_RECORD_EXCEEDS_MAXSIZE: DWORD = 5030; -pub const ERROR_CLUSTERLOG_EXCEEDS_MAXSIZE: DWORD = 5031; -pub const ERROR_CLUSTERLOG_CHKPOINT_NOT_FOUND: DWORD = 5032; -pub const ERROR_CLUSTERLOG_NOT_ENOUGH_SPACE: DWORD = 5033; -pub const ERROR_QUORUM_OWNER_ALIVE: DWORD = 5034; -pub const ERROR_NETWORK_NOT_AVAILABLE: DWORD = 5035; -pub const ERROR_NODE_NOT_AVAILABLE: DWORD = 5036; -pub const ERROR_ALL_NODES_NOT_AVAILABLE: DWORD = 5037; -pub const ERROR_RESOURCE_FAILED: DWORD = 5038; -pub const ERROR_CLUSTER_INVALID_NODE: DWORD = 5039; -pub const ERROR_CLUSTER_NODE_EXISTS: DWORD = 5040; -pub const ERROR_CLUSTER_JOIN_IN_PROGRESS: DWORD = 5041; -pub const ERROR_CLUSTER_NODE_NOT_FOUND: DWORD = 5042; -pub const ERROR_CLUSTER_LOCAL_NODE_NOT_FOUND: DWORD = 5043; -pub const ERROR_CLUSTER_NETWORK_EXISTS: DWORD = 5044; -pub const ERROR_CLUSTER_NETWORK_NOT_FOUND: DWORD = 5045; -pub const ERROR_CLUSTER_NETINTERFACE_EXISTS: DWORD = 5046; -pub const ERROR_CLUSTER_NETINTERFACE_NOT_FOUND: DWORD = 5047; -pub const ERROR_CLUSTER_INVALID_REQUEST: DWORD = 5048; -pub const ERROR_CLUSTER_INVALID_NETWORK_PROVIDER: DWORD = 5049; -pub const ERROR_CLUSTER_NODE_DOWN: DWORD = 5050; -pub const ERROR_CLUSTER_NODE_UNREACHABLE: DWORD = 5051; -pub const ERROR_CLUSTER_NODE_NOT_MEMBER: DWORD = 5052; -pub const ERROR_CLUSTER_JOIN_NOT_IN_PROGRESS: DWORD = 5053; -pub const ERROR_CLUSTER_INVALID_NETWORK: DWORD = 5054; -pub const ERROR_CLUSTER_NODE_UP: DWORD = 5056; -pub const ERROR_CLUSTER_IPADDR_IN_USE: DWORD = 5057; -pub const ERROR_CLUSTER_NODE_NOT_PAUSED: DWORD = 5058; -pub const ERROR_CLUSTER_NO_SECURITY_CONTEXT: DWORD = 5059; -pub const ERROR_CLUSTER_NETWORK_NOT_INTERNAL: DWORD = 5060; -pub const ERROR_CLUSTER_NODE_ALREADY_UP: DWORD = 5061; -pub const ERROR_CLUSTER_NODE_ALREADY_DOWN: DWORD = 5062; -pub const ERROR_CLUSTER_NETWORK_ALREADY_ONLINE: DWORD = 5063; -pub const ERROR_CLUSTER_NETWORK_ALREADY_OFFLINE: DWORD = 5064; -pub const ERROR_CLUSTER_NODE_ALREADY_MEMBER: DWORD = 5065; -pub const ERROR_CLUSTER_LAST_INTERNAL_NETWORK: DWORD = 5066; -pub const ERROR_CLUSTER_NETWORK_HAS_DEPENDENTS: DWORD = 5067; -pub const ERROR_INVALID_OPERATION_ON_QUORUM: DWORD = 5068; -pub const ERROR_DEPENDENCY_NOT_ALLOWED: DWORD = 5069; -pub const ERROR_CLUSTER_NODE_PAUSED: DWORD = 5070; -pub const ERROR_NODE_CANT_HOST_RESOURCE: DWORD = 5071; -pub const ERROR_CLUSTER_NODE_NOT_READY: DWORD = 5072; -pub const ERROR_CLUSTER_NODE_SHUTTING_DOWN: DWORD = 5073; -pub const ERROR_CLUSTER_JOIN_ABORTED: DWORD = 5074; -pub const ERROR_CLUSTER_INCOMPATIBLE_VERSIONS: DWORD = 5075; -pub const ERROR_CLUSTER_MAXNUM_OF_RESOURCES_EXCEEDED: DWORD = 5076; -pub const ERROR_CLUSTER_SYSTEM_CONFIG_CHANGED: DWORD = 5077; -pub const ERROR_CLUSTER_RESOURCE_TYPE_NOT_FOUND: DWORD = 5078; -pub const ERROR_CLUSTER_RESTYPE_NOT_SUPPORTED: DWORD = 5079; -pub const ERROR_CLUSTER_RESNAME_NOT_FOUND: DWORD = 5080; -pub const ERROR_CLUSTER_NO_RPC_PACKAGES_REGISTERED: DWORD = 5081; -pub const ERROR_CLUSTER_OWNER_NOT_IN_PREFLIST: DWORD = 5082; -pub const ERROR_CLUSTER_DATABASE_SEQMISMATCH: DWORD = 5083; -pub const ERROR_RESMON_INVALID_STATE: DWORD = 5084; -pub const ERROR_CLUSTER_GUM_NOT_LOCKER: DWORD = 5085; -pub const ERROR_QUORUM_DISK_NOT_FOUND: DWORD = 5086; -pub const ERROR_DATABASE_BACKUP_CORRUPT: DWORD = 5087; -pub const ERROR_CLUSTER_NODE_ALREADY_HAS_DFS_ROOT: DWORD = 5088; -pub const ERROR_RESOURCE_PROPERTY_UNCHANGEABLE: DWORD = 5089; -pub const ERROR_CLUSTER_MEMBERSHIP_INVALID_STATE: DWORD = 5890; -pub const ERROR_CLUSTER_QUORUMLOG_NOT_FOUND: DWORD = 5891; -pub const ERROR_CLUSTER_MEMBERSHIP_HALT: DWORD = 5892; -pub const ERROR_CLUSTER_INSTANCE_ID_MISMATCH: DWORD = 5893; -pub const ERROR_CLUSTER_NETWORK_NOT_FOUND_FOR_IP: DWORD = 5894; -pub const ERROR_CLUSTER_PROPERTY_DATA_TYPE_MISMATCH: DWORD = 5895; -pub const ERROR_CLUSTER_EVICT_WITHOUT_CLEANUP: DWORD = 5896; -pub const ERROR_CLUSTER_PARAMETER_MISMATCH: DWORD = 5897; -pub const ERROR_NODE_CANNOT_BE_CLUSTERED: DWORD = 5898; -pub const ERROR_CLUSTER_WRONG_OS_VERSION: DWORD = 5899; -pub const ERROR_CLUSTER_CANT_CREATE_DUP_CLUSTER_NAME: DWORD = 5900; -pub const ERROR_CLUSCFG_ALREADY_COMMITTED: DWORD = 5901; -pub const ERROR_CLUSCFG_ROLLBACK_FAILED: DWORD = 5902; -pub const ERROR_CLUSCFG_SYSTEM_DISK_DRIVE_LETTER_CONFLICT: DWORD = 5903; -pub const ERROR_CLUSTER_OLD_VERSION: DWORD = 5904; -pub const ERROR_CLUSTER_MISMATCHED_COMPUTER_ACCT_NAME: DWORD = 5905; -pub const ERROR_ENCRYPTION_FAILED: DWORD = 6000; -pub const ERROR_DECRYPTION_FAILED: DWORD = 6001; -pub const ERROR_FILE_ENCRYPTED: DWORD = 6002; -pub const ERROR_NO_RECOVERY_POLICY: DWORD = 6003; -pub const ERROR_NO_EFS: DWORD = 6004; -pub const ERROR_WRONG_EFS: DWORD = 6005; -pub const ERROR_NO_USER_KEYS: DWORD = 6006; -pub const ERROR_FILE_NOT_ENCRYPTED: DWORD = 6007; -pub const ERROR_NOT_EXPORT_FORMAT: DWORD = 6008; -pub const ERROR_FILE_READ_ONLY: DWORD = 6009; -pub const ERROR_DIR_EFS_DISALLOWED: DWORD = 6010; -pub const ERROR_EFS_SERVER_NOT_TRUSTED: DWORD = 6011; -pub const ERROR_BAD_RECOVERY_POLICY: DWORD = 6012; -pub const ERROR_EFS_ALG_BLOB_TOO_BIG: DWORD = 6013; -pub const ERROR_VOLUME_NOT_SUPPORT_EFS: DWORD = 6014; -pub const ERROR_EFS_DISABLED: DWORD = 6015; -pub const ERROR_EFS_VERSION_NOT_SUPPORT: DWORD = 6016; -pub const ERROR_NO_BROWSER_SERVERS_FOUND: DWORD = 6118; -pub const ERROR_CTX_WINSTATION_NAME_INVALID: DWORD = 7001; -pub const ERROR_CTX_INVALID_PD: DWORD = 7002; -pub const ERROR_CTX_PD_NOT_FOUND: DWORD = 7003; -pub const ERROR_CTX_WD_NOT_FOUND: DWORD = 7004; -pub const ERROR_CTX_CANNOT_MAKE_EVENTLOG_ENTRY: DWORD = 7005; -pub const ERROR_CTX_SERVICE_NAME_COLLISION: DWORD = 7006; -pub const ERROR_CTX_CLOSE_PENDING: DWORD = 7007; -pub const ERROR_CTX_NO_OUTBUF: DWORD = 7008; -pub const ERROR_CTX_MODEM_INF_NOT_FOUND: DWORD = 7009; -pub const ERROR_CTX_INVALID_MODEMNAME: DWORD = 7010; -pub const ERROR_CTX_MODEM_RESPONSE_ERROR: DWORD = 7011; -pub const ERROR_CTX_MODEM_RESPONSE_TIMEOUT: DWORD = 7012; -pub const ERROR_CTX_MODEM_RESPONSE_NO_CARRIER: DWORD = 7013; -pub const ERROR_CTX_MODEM_RESPONSE_NO_DIALTONE: DWORD = 7014; -pub const ERROR_CTX_MODEM_RESPONSE_BUSY: DWORD = 7015; -pub const ERROR_CTX_MODEM_RESPONSE_VOICE: DWORD = 7016; -pub const ERROR_CTX_TD_ERROR: DWORD = 7017; -pub const ERROR_CTX_WINSTATION_NOT_FOUND: DWORD = 7022; -pub const ERROR_CTX_WINSTATION_ALREADY_EXISTS: DWORD = 7023; -pub const ERROR_CTX_WINSTATION_BUSY: DWORD = 7024; -pub const ERROR_CTX_BAD_VIDEO_MODE: DWORD = 7025; -pub const ERROR_CTX_GRAPHICS_INVALID: DWORD = 7035; -pub const ERROR_CTX_LOGON_DISABLED: DWORD = 7037; -pub const ERROR_CTX_NOT_CONSOLE: DWORD = 7038; -pub const ERROR_CTX_CLIENT_QUERY_TIMEOUT: DWORD = 7040; -pub const ERROR_CTX_CONSOLE_DISCONNECT: DWORD = 7041; -pub const ERROR_CTX_CONSOLE_CONNECT: DWORD = 7042; -pub const ERROR_CTX_SHADOW_DENIED: DWORD = 7044; -pub const ERROR_CTX_WINSTATION_ACCESS_DENIED: DWORD = 7045; -pub const ERROR_CTX_INVALID_WD: DWORD = 7049; -pub const ERROR_CTX_SHADOW_INVALID: DWORD = 7050; -pub const ERROR_CTX_SHADOW_DISABLED: DWORD = 7051; -pub const ERROR_CTX_CLIENT_LICENSE_IN_USE: DWORD = 7052; -pub const ERROR_CTX_CLIENT_LICENSE_NOT_SET: DWORD = 7053; -pub const ERROR_CTX_LICENSE_NOT_AVAILABLE: DWORD = 7054; -pub const ERROR_CTX_LICENSE_CLIENT_INVALID: DWORD = 7055; -pub const ERROR_CTX_LICENSE_EXPIRED: DWORD = 7056; -pub const ERROR_CTX_SHADOW_NOT_RUNNING: DWORD = 7057; -pub const ERROR_CTX_SHADOW_ENDED_BY_MODE_CHANGE: DWORD = 7058; -pub const ERROR_ACTIVATION_COUNT_EXCEEDED: DWORD = 7059; -pub const ERROR_DS_NOT_INSTALLED: DWORD = 8200; -pub const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY: DWORD = 8201; -pub const ERROR_DS_NO_ATTRIBUTE_OR_VALUE: DWORD = 8202; -pub const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX: DWORD = 8203; -pub const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED: DWORD = 8204; -pub const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS: DWORD = 8205; -pub const ERROR_DS_BUSY: DWORD = 8206; -pub const ERROR_DS_UNAVAILABLE: DWORD = 8207; -pub const ERROR_DS_NO_RIDS_ALLOCATED: DWORD = 8208; -pub const ERROR_DS_NO_MORE_RIDS: DWORD = 8209; -pub const ERROR_DS_INCORRECT_ROLE_OWNER: DWORD = 8210; -pub const ERROR_DS_RIDMGR_INIT_ERROR: DWORD = 8211; -pub const ERROR_DS_OBJ_CLASS_VIOLATION: DWORD = 8212; -pub const ERROR_DS_CANT_ON_NON_LEAF: DWORD = 8213; -pub const ERROR_DS_CANT_ON_RDN: DWORD = 8214; -pub const ERROR_DS_CANT_MOD_OBJ_CLASS: DWORD = 8215; -pub const ERROR_DS_CROSS_DOM_MOVE_ERROR: DWORD = 8216; -pub const ERROR_DS_GC_NOT_AVAILABLE: DWORD = 8217; -pub const ERROR_SHARED_POLICY: DWORD = 8218; -pub const ERROR_POLICY_OBJECT_NOT_FOUND: DWORD = 8219; -pub const ERROR_POLICY_ONLY_IN_DS: DWORD = 8220; -pub const ERROR_PROMOTION_ACTIVE: DWORD = 8221; -pub const ERROR_NO_PROMOTION_ACTIVE: DWORD = 8222; -pub const ERROR_DS_OPERATIONS_ERROR: DWORD = 8224; -pub const ERROR_DS_PROTOCOL_ERROR: DWORD = 8225; -pub const ERROR_DS_TIMELIMIT_EXCEEDED: DWORD = 8226; -pub const ERROR_DS_SIZELIMIT_EXCEEDED: DWORD = 8227; -pub const ERROR_DS_ADMIN_LIMIT_EXCEEDED: DWORD = 8228; -pub const ERROR_DS_COMPARE_FALSE: DWORD = 8229; -pub const ERROR_DS_COMPARE_TRUE: DWORD = 8230; -pub const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED: DWORD = 8231; -pub const ERROR_DS_STRONG_AUTH_REQUIRED: DWORD = 8232; -pub const ERROR_DS_INAPPROPRIATE_AUTH: DWORD = 8233; -pub const ERROR_DS_AUTH_UNKNOWN: DWORD = 8234; -pub const ERROR_DS_REFERRAL: DWORD = 8235; -pub const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION: DWORD = 8236; -pub const ERROR_DS_CONFIDENTIALITY_REQUIRED: DWORD = 8237; -pub const ERROR_DS_INAPPROPRIATE_MATCHING: DWORD = 8238; -pub const ERROR_DS_CONSTRAINT_VIOLATION: DWORD = 8239; -pub const ERROR_DS_NO_SUCH_OBJECT: DWORD = 8240; -pub const ERROR_DS_ALIAS_PROBLEM: DWORD = 8241; -pub const ERROR_DS_INVALID_DN_SYNTAX: DWORD = 8242; -pub const ERROR_DS_IS_LEAF: DWORD = 8243; -pub const ERROR_DS_ALIAS_DEREF_PROBLEM: DWORD = 8244; -pub const ERROR_DS_UNWILLING_TO_PERFORM: DWORD = 8245; -pub const ERROR_DS_LOOP_DETECT: DWORD = 8246; -pub const ERROR_DS_NAMING_VIOLATION: DWORD = 8247; -pub const ERROR_DS_OBJECT_RESULTS_TOO_LARGE: DWORD = 8248; -pub const ERROR_DS_AFFECTS_MULTIPLE_DSAS: DWORD = 8249; -pub const ERROR_DS_SERVER_DOWN: DWORD = 8250; -pub const ERROR_DS_LOCAL_ERROR: DWORD = 8251; -pub const ERROR_DS_ENCODING_ERROR: DWORD = 8252; -pub const ERROR_DS_DECODING_ERROR: DWORD = 8253; -pub const ERROR_DS_FILTER_UNKNOWN: DWORD = 8254; -pub const ERROR_DS_PARAM_ERROR: DWORD = 8255; -pub const ERROR_DS_NOT_SUPPORTED: DWORD = 8256; -pub const ERROR_DS_NO_RESULTS_RETURNED: DWORD = 8257; -pub const ERROR_DS_CONTROL_NOT_FOUND: DWORD = 8258; -pub const ERROR_DS_CLIENT_LOOP: DWORD = 8259; -pub const ERROR_DS_REFERRAL_LIMIT_EXCEEDED: DWORD = 8260; -pub const ERROR_DS_SORT_CONTROL_MISSING: DWORD = 8261; -pub const ERROR_DS_OFFSET_RANGE_ERROR: DWORD = 8262; -pub const ERROR_DS_ROOT_MUST_BE_NC: DWORD = 8301; -pub const ERROR_DS_ADD_REPLICA_INHIBITED: DWORD = 8302; -pub const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA: DWORD = 8303; -pub const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED: DWORD = 8304; -pub const ERROR_DS_OBJ_STRING_NAME_EXISTS: DWORD = 8305; -pub const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA: DWORD = 8306; -pub const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA: DWORD = 8307; -pub const ERROR_DS_NO_REQUESTED_ATTS_FOUND: DWORD = 8308; -pub const ERROR_DS_USER_BUFFER_TO_SMALL: DWORD = 8309; -pub const ERROR_DS_ATT_IS_NOT_ON_OBJ: DWORD = 8310; -pub const ERROR_DS_ILLEGAL_MOD_OPERATION: DWORD = 8311; -pub const ERROR_DS_OBJ_TOO_LARGE: DWORD = 8312; -pub const ERROR_DS_BAD_INSTANCE_TYPE: DWORD = 8313; -pub const ERROR_DS_MASTERDSA_REQUIRED: DWORD = 8314; -pub const ERROR_DS_OBJECT_CLASS_REQUIRED: DWORD = 8315; -pub const ERROR_DS_MISSING_REQUIRED_ATT: DWORD = 8316; -pub const ERROR_DS_ATT_NOT_DEF_FOR_CLASS: DWORD = 8317; -pub const ERROR_DS_ATT_ALREADY_EXISTS: DWORD = 8318; -pub const ERROR_DS_CANT_ADD_ATT_VALUES: DWORD = 8320; -pub const ERROR_DS_SINGLE_VALUE_CONSTRAINT: DWORD = 8321; -pub const ERROR_DS_RANGE_CONSTRAINT: DWORD = 8322; -pub const ERROR_DS_ATT_VAL_ALREADY_EXISTS: DWORD = 8323; -pub const ERROR_DS_CANT_REM_MISSING_ATT: DWORD = 8324; -pub const ERROR_DS_CANT_REM_MISSING_ATT_VAL: DWORD = 8325; -pub const ERROR_DS_ROOT_CANT_BE_SUBREF: DWORD = 8326; -pub const ERROR_DS_NO_CHAINING: DWORD = 8327; -pub const ERROR_DS_NO_CHAINED_EVAL: DWORD = 8328; -pub const ERROR_DS_NO_PARENT_OBJECT: DWORD = 8329; -pub const ERROR_DS_PARENT_IS_AN_ALIAS: DWORD = 8330; -pub const ERROR_DS_CANT_MIX_MASTER_AND_REPS: DWORD = 8331; -pub const ERROR_DS_CHILDREN_EXIST: DWORD = 8332; -pub const ERROR_DS_OBJ_NOT_FOUND: DWORD = 8333; -pub const ERROR_DS_ALIASED_OBJ_MISSING: DWORD = 8334; -pub const ERROR_DS_BAD_NAME_SYNTAX: DWORD = 8335; -pub const ERROR_DS_ALIAS_POINTS_TO_ALIAS: DWORD = 8336; -pub const ERROR_DS_CANT_DEREF_ALIAS: DWORD = 8337; -pub const ERROR_DS_OUT_OF_SCOPE: DWORD = 8338; -pub const ERROR_DS_OBJECT_BEING_REMOVED: DWORD = 8339; -pub const ERROR_DS_CANT_DELETE_DSA_OBJ: DWORD = 8340; -pub const ERROR_DS_GENERIC_ERROR: DWORD = 8341; -pub const ERROR_DS_DSA_MUST_BE_INT_MASTER: DWORD = 8342; -pub const ERROR_DS_CLASS_NOT_DSA: DWORD = 8343; -pub const ERROR_DS_INSUFF_ACCESS_RIGHTS: DWORD = 8344; -pub const ERROR_DS_ILLEGAL_SUPERIOR: DWORD = 8345; -pub const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM: DWORD = 8346; -pub const ERROR_DS_NAME_TOO_MANY_PARTS: DWORD = 8347; -pub const ERROR_DS_NAME_TOO_LONG: DWORD = 8348; -pub const ERROR_DS_NAME_VALUE_TOO_LONG: DWORD = 8349; -pub const ERROR_DS_NAME_UNPARSEABLE: DWORD = 8350; -pub const ERROR_DS_NAME_TYPE_UNKNOWN: DWORD = 8351; -pub const ERROR_DS_NOT_AN_OBJECT: DWORD = 8352; -pub const ERROR_DS_SEC_DESC_TOO_SHORT: DWORD = 8353; -pub const ERROR_DS_SEC_DESC_INVALID: DWORD = 8354; -pub const ERROR_DS_NO_DELETED_NAME: DWORD = 8355; -pub const ERROR_DS_SUBREF_MUST_HAVE_PARENT: DWORD = 8356; -pub const ERROR_DS_NCNAME_MUST_BE_NC: DWORD = 8357; -pub const ERROR_DS_CANT_ADD_SYSTEM_ONLY: DWORD = 8358; -pub const ERROR_DS_CLASS_MUST_BE_CONCRETE: DWORD = 8359; -pub const ERROR_DS_INVALID_DMD: DWORD = 8360; -pub const ERROR_DS_OBJ_GUID_EXISTS: DWORD = 8361; -pub const ERROR_DS_NOT_ON_BACKLINK: DWORD = 8362; -pub const ERROR_DS_NO_CROSSREF_FOR_NC: DWORD = 8363; -pub const ERROR_DS_SHUTTING_DOWN: DWORD = 8364; -pub const ERROR_DS_UNKNOWN_OPERATION: DWORD = 8365; -pub const ERROR_DS_INVALID_ROLE_OWNER: DWORD = 8366; -pub const ERROR_DS_COULDNT_CONTACT_FSMO: DWORD = 8367; -pub const ERROR_DS_CROSS_NC_DN_RENAME: DWORD = 8368; -pub const ERROR_DS_CANT_MOD_SYSTEM_ONLY: DWORD = 8369; -pub const ERROR_DS_REPLICATOR_ONLY: DWORD = 8370; -pub const ERROR_DS_OBJ_CLASS_NOT_DEFINED: DWORD = 8371; -pub const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS: DWORD = 8372; -pub const ERROR_DS_NAME_REFERENCE_INVALID: DWORD = 8373; -pub const ERROR_DS_CROSS_REF_EXISTS: DWORD = 8374; -pub const ERROR_DS_CANT_DEL_MASTER_CROSSREF: DWORD = 8375; -pub const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD: DWORD = 8376; -pub const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX: DWORD = 8377; -pub const ERROR_DS_DUP_RDN: DWORD = 8378; -pub const ERROR_DS_DUP_OID: DWORD = 8379; -pub const ERROR_DS_DUP_MAPI_ID: DWORD = 8380; -pub const ERROR_DS_DUP_SCHEMA_ID_GUID: DWORD = 8381; -pub const ERROR_DS_DUP_LDAP_DISPLAY_NAME: DWORD = 8382; -pub const ERROR_DS_SEMANTIC_ATT_TEST: DWORD = 8383; -pub const ERROR_DS_SYNTAX_MISMATCH: DWORD = 8384; -pub const ERROR_DS_EXISTS_IN_MUST_HAVE: DWORD = 8385; -pub const ERROR_DS_EXISTS_IN_MAY_HAVE: DWORD = 8386; -pub const ERROR_DS_NONEXISTENT_MAY_HAVE: DWORD = 8387; -pub const ERROR_DS_NONEXISTENT_MUST_HAVE: DWORD = 8388; -pub const ERROR_DS_AUX_CLS_TEST_FAIL: DWORD = 8389; -pub const ERROR_DS_NONEXISTENT_POSS_SUP: DWORD = 8390; -pub const ERROR_DS_SUB_CLS_TEST_FAIL: DWORD = 8391; -pub const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX: DWORD = 8392; -pub const ERROR_DS_EXISTS_IN_AUX_CLS: DWORD = 8393; -pub const ERROR_DS_EXISTS_IN_SUB_CLS: DWORD = 8394; -pub const ERROR_DS_EXISTS_IN_POSS_SUP: DWORD = 8395; -pub const ERROR_DS_RECALCSCHEMA_FAILED: DWORD = 8396; -pub const ERROR_DS_TREE_DELETE_NOT_FINISHED: DWORD = 8397; -pub const ERROR_DS_CANT_DELETE: DWORD = 8398; -pub const ERROR_DS_ATT_SCHEMA_REQ_ID: DWORD = 8399; -pub const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX: DWORD = 8400; -pub const ERROR_DS_CANT_CACHE_ATT: DWORD = 8401; -pub const ERROR_DS_CANT_CACHE_CLASS: DWORD = 8402; -pub const ERROR_DS_CANT_REMOVE_ATT_CACHE: DWORD = 8403; -pub const ERROR_DS_CANT_REMOVE_CLASS_CACHE: DWORD = 8404; -pub const ERROR_DS_CANT_RETRIEVE_DN: DWORD = 8405; -pub const ERROR_DS_MISSING_SUPREF: DWORD = 8406; -pub const ERROR_DS_CANT_RETRIEVE_INSTANCE: DWORD = 8407; -pub const ERROR_DS_CODE_INCONSISTENCY: DWORD = 8408; -pub const ERROR_DS_DATABASE_ERROR: DWORD = 8409; -pub const ERROR_DS_GOVERNSID_MISSING: DWORD = 8410; -pub const ERROR_DS_MISSING_EXPECTED_ATT: DWORD = 8411; -pub const ERROR_DS_NCNAME_MISSING_CR_REF: DWORD = 8412; -pub const ERROR_DS_SECURITY_CHECKING_ERROR: DWORD = 8413; -pub const ERROR_DS_SCHEMA_NOT_LOADED: DWORD = 8414; -pub const ERROR_DS_SCHEMA_ALLOC_FAILED: DWORD = 8415; -pub const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX: DWORD = 8416; -pub const ERROR_DS_GCVERIFY_ERROR: DWORD = 8417; -pub const ERROR_DS_DRA_SCHEMA_MISMATCH: DWORD = 8418; -pub const ERROR_DS_CANT_FIND_DSA_OBJ: DWORD = 8419; -pub const ERROR_DS_CANT_FIND_EXPECTED_NC: DWORD = 8420; -pub const ERROR_DS_CANT_FIND_NC_IN_CACHE: DWORD = 8421; -pub const ERROR_DS_CANT_RETRIEVE_CHILD: DWORD = 8422; -pub const ERROR_DS_SECURITY_ILLEGAL_MODIFY: DWORD = 8423; -pub const ERROR_DS_CANT_REPLACE_HIDDEN_REC: DWORD = 8424; -pub const ERROR_DS_BAD_HIERARCHY_FILE: DWORD = 8425; -pub const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED: DWORD = 8426; -pub const ERROR_DS_CONFIG_PARAM_MISSING: DWORD = 8427; -pub const ERROR_DS_COUNTING_AB_INDICES_FAILED: DWORD = 8428; -pub const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED: DWORD = 8429; -pub const ERROR_DS_INTERNAL_FAILURE: DWORD = 8430; -pub const ERROR_DS_UNKNOWN_ERROR: DWORD = 8431; -pub const ERROR_DS_ROOT_REQUIRES_CLASS_TOP: DWORD = 8432; -pub const ERROR_DS_REFUSING_FSMO_ROLES: DWORD = 8433; -pub const ERROR_DS_MISSING_FSMO_SETTINGS: DWORD = 8434; -pub const ERROR_DS_UNABLE_TO_SURRENDER_ROLES: DWORD = 8435; -pub const ERROR_DS_DRA_GENERIC: DWORD = 8436; -pub const ERROR_DS_DRA_INVALID_PARAMETER: DWORD = 8437; -pub const ERROR_DS_DRA_BUSY: DWORD = 8438; -pub const ERROR_DS_DRA_BAD_DN: DWORD = 8439; -pub const ERROR_DS_DRA_BAD_NC: DWORD = 8440; -pub const ERROR_DS_DRA_DN_EXISTS: DWORD = 8441; -pub const ERROR_DS_DRA_INTERNAL_ERROR: DWORD = 8442; -pub const ERROR_DS_DRA_INCONSISTENT_DIT: DWORD = 8443; -pub const ERROR_DS_DRA_CONNECTION_FAILED: DWORD = 8444; -pub const ERROR_DS_DRA_BAD_INSTANCE_TYPE: DWORD = 8445; -pub const ERROR_DS_DRA_OUT_OF_MEM: DWORD = 8446; -pub const ERROR_DS_DRA_MAIL_PROBLEM: DWORD = 8447; -pub const ERROR_DS_DRA_REF_ALREADY_EXISTS: DWORD = 8448; -pub const ERROR_DS_DRA_REF_NOT_FOUND: DWORD = 8449; -pub const ERROR_DS_DRA_OBJ_IS_REP_SOURCE: DWORD = 8450; -pub const ERROR_DS_DRA_DB_ERROR: DWORD = 8451; -pub const ERROR_DS_DRA_NO_REPLICA: DWORD = 8452; -pub const ERROR_DS_DRA_ACCESS_DENIED: DWORD = 8453; -pub const ERROR_DS_DRA_NOT_SUPPORTED: DWORD = 8454; -pub const ERROR_DS_DRA_RPC_CANCELLED: DWORD = 8455; -pub const ERROR_DS_DRA_SOURCE_DISABLED: DWORD = 8456; -pub const ERROR_DS_DRA_SINK_DISABLED: DWORD = 8457; -pub const ERROR_DS_DRA_NAME_COLLISION: DWORD = 8458; -pub const ERROR_DS_DRA_SOURCE_REINSTALLED: DWORD = 8459; -pub const ERROR_DS_DRA_MISSING_PARENT: DWORD = 8460; -pub const ERROR_DS_DRA_PREEMPTED: DWORD = 8461; -pub const ERROR_DS_DRA_ABANDON_SYNC: DWORD = 8462; -pub const ERROR_DS_DRA_SHUTDOWN: DWORD = 8463; -pub const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET: DWORD = 8464; -pub const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA: DWORD = 8465; -pub const ERROR_DS_DRA_EXTN_CONNECTION_FAILED: DWORD = 8466; -pub const ERROR_DS_INSTALL_SCHEMA_MISMATCH: DWORD = 8467; -pub const ERROR_DS_DUP_LINK_ID: DWORD = 8468; -pub const ERROR_DS_NAME_ERROR_RESOLVING: DWORD = 8469; -pub const ERROR_DS_NAME_ERROR_NOT_FOUND: DWORD = 8470; -pub const ERROR_DS_NAME_ERROR_NOT_UNIQUE: DWORD = 8471; -pub const ERROR_DS_NAME_ERROR_NO_MAPPING: DWORD = 8472; -pub const ERROR_DS_NAME_ERROR_DOMAIN_ONLY: DWORD = 8473; -pub const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: DWORD = 8474; -pub const ERROR_DS_CONSTRUCTED_ATT_MOD: DWORD = 8475; -pub const ERROR_DS_WRONG_OM_OBJ_CLASS: DWORD = 8476; -pub const ERROR_DS_DRA_REPL_PENDING: DWORD = 8477; -pub const ERROR_DS_DS_REQUIRED: DWORD = 8478; -pub const ERROR_DS_INVALID_LDAP_DISPLAY_NAME: DWORD = 8479; -pub const ERROR_DS_NON_BASE_SEARCH: DWORD = 8480; -pub const ERROR_DS_CANT_RETRIEVE_ATTS: DWORD = 8481; -pub const ERROR_DS_BACKLINK_WITHOUT_LINK: DWORD = 8482; -pub const ERROR_DS_EPOCH_MISMATCH: DWORD = 8483; -pub const ERROR_DS_SRC_NAME_MISMATCH: DWORD = 8484; -pub const ERROR_DS_SRC_AND_DST_NC_IDENTICAL: DWORD = 8485; -pub const ERROR_DS_DST_NC_MISMATCH: DWORD = 8486; -pub const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC: DWORD = 8487; -pub const ERROR_DS_SRC_GUID_MISMATCH: DWORD = 8488; -pub const ERROR_DS_CANT_MOVE_DELETED_OBJECT: DWORD = 8489; -pub const ERROR_DS_PDC_OPERATION_IN_PROGRESS: DWORD = 8490; -pub const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD: DWORD = 8491; -pub const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION: DWORD = 8492; -pub const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS: DWORD = 8493; -pub const ERROR_DS_NC_MUST_HAVE_NC_PARENT: DWORD = 8494; -pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE: DWORD = 8495; -pub const ERROR_DS_DST_DOMAIN_NOT_NATIVE: DWORD = 8496; -pub const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER: DWORD = 8497; -pub const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP: DWORD = 8498; -pub const ERROR_DS_CANT_MOVE_RESOURCE_GROUP: DWORD = 8499; -pub const ERROR_DS_INVALID_SEARCH_FLAG: DWORD = 8500; -pub const ERROR_DS_NO_TREE_DELETE_ABOVE_NC: DWORD = 8501; -pub const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE: DWORD = 8502; -pub const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE: DWORD = 8503; -pub const ERROR_DS_SAM_INIT_FAILURE: DWORD = 8504; -pub const ERROR_DS_SENSITIVE_GROUP_VIOLATION: DWORD = 8505; -pub const ERROR_DS_CANT_MOD_PRIMARYGROUPID: DWORD = 8506; -pub const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD: DWORD = 8507; -pub const ERROR_DS_NONSAFE_SCHEMA_CHANGE: DWORD = 8508; -pub const ERROR_DS_SCHEMA_UPDATE_DISALLOWED: DWORD = 8509; -pub const ERROR_DS_CANT_CREATE_UNDER_SCHEMA: DWORD = 8510; -pub const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION: DWORD = 8511; -pub const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE: DWORD = 8512; -pub const ERROR_DS_INVALID_GROUP_TYPE: DWORD = 8513; -pub const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: DWORD = 8514; -pub const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: DWORD = 8515; -pub const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: DWORD = 8516; -pub const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: DWORD = 8517; -pub const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: DWORD = 8518; -pub const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: DWORD = 8519; -pub const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: DWORD = 8520; -pub const ERROR_DS_HAVE_PRIMARY_MEMBERS: DWORD = 8521; -pub const ERROR_DS_STRING_SD_CONVERSION_FAILED: DWORD = 8522; -pub const ERROR_DS_NAMING_MASTER_GC: DWORD = 8523; -pub const ERROR_DS_DNS_LOOKUP_FAILURE: DWORD = 8524; -pub const ERROR_DS_COULDNT_UPDATE_SPNS: DWORD = 8525; -pub const ERROR_DS_CANT_RETRIEVE_SD: DWORD = 8526; -pub const ERROR_DS_KEY_NOT_UNIQUE: DWORD = 8527; -pub const ERROR_DS_WRONG_LINKED_ATT_SYNTAX: DWORD = 8528; -pub const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD: DWORD = 8529; -pub const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY: DWORD = 8530; -pub const ERROR_DS_CANT_START: DWORD = 8531; -pub const ERROR_DS_INIT_FAILURE: DWORD = 8532; -pub const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION: DWORD = 8533; -pub const ERROR_DS_SOURCE_DOMAIN_IN_FOREST: DWORD = 8534; -pub const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST: DWORD = 8535; -pub const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED: DWORD = 8536; -pub const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN: DWORD = 8537; -pub const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER: DWORD = 8538; -pub const ERROR_DS_SRC_SID_EXISTS_IN_FOREST: DWORD = 8539; -pub const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH: DWORD = 8540; -pub const ERROR_SAM_INIT_FAILURE: DWORD = 8541; -pub const ERROR_DS_DRA_SCHEMA_INFO_SHIP: DWORD = 8542; -pub const ERROR_DS_DRA_SCHEMA_CONFLICT: DWORD = 8543; -pub const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT: DWORD = 8544; -pub const ERROR_DS_DRA_OBJ_NC_MISMATCH: DWORD = 8545; -pub const ERROR_DS_NC_STILL_HAS_DSAS: DWORD = 8546; -pub const ERROR_DS_GC_REQUIRED: DWORD = 8547; -pub const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: DWORD = 8548; -pub const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS: DWORD = 8549; -pub const ERROR_DS_CANT_ADD_TO_GC: DWORD = 8550; -pub const ERROR_DS_NO_CHECKPOINT_WITH_PDC: DWORD = 8551; -pub const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED: DWORD = 8552; -pub const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC: DWORD = 8553; -pub const ERROR_DS_INVALID_NAME_FOR_SPN: DWORD = 8554; -pub const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS: DWORD = 8555; -pub const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES: DWORD = 8556; -pub const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: DWORD = 8557; -pub const ERROR_DS_MUST_BE_RUN_ON_DST_DC: DWORD = 8558; -pub const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER: DWORD = 8559; -pub const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ: DWORD = 8560; -pub const ERROR_DS_INIT_FAILURE_CONSOLE: DWORD = 8561; -pub const ERROR_DS_SAM_INIT_FAILURE_CONSOLE: DWORD = 8562; -pub const ERROR_DS_FOREST_VERSION_TOO_HIGH: DWORD = 8563; -pub const ERROR_DS_DOMAIN_VERSION_TOO_HIGH: DWORD = 8564; -pub const ERROR_DS_FOREST_VERSION_TOO_LOW: DWORD = 8565; -pub const ERROR_DS_DOMAIN_VERSION_TOO_LOW: DWORD = 8566; -pub const ERROR_DS_INCOMPATIBLE_VERSION: DWORD = 8567; -pub const ERROR_DS_LOW_DSA_VERSION: DWORD = 8568; -pub const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN: DWORD = 8569; -pub const ERROR_DS_NOT_SUPPORTED_SORT_ORDER: DWORD = 8570; -pub const ERROR_DS_NAME_NOT_UNIQUE: DWORD = 8571; -pub const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4: DWORD = 8572; -pub const ERROR_DS_OUT_OF_VERSION_STORE: DWORD = 8573; -pub const ERROR_DS_INCOMPATIBLE_CONTROLS_USED: DWORD = 8574; -pub const ERROR_DS_NO_REF_DOMAIN: DWORD = 8575; -pub const ERROR_DS_RESERVED_LINK_ID: DWORD = 8576; -pub const ERROR_DS_LINK_ID_NOT_AVAILABLE: DWORD = 8577; -pub const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: DWORD = 8578; -pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE: DWORD = 8579; -pub const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC: DWORD = 8580; -pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG: DWORD = 8581; -pub const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT: DWORD = 8582; -pub const ERROR_DS_NAME_ERROR_TRUST_REFERRAL: DWORD = 8583; -pub const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER: DWORD = 8584; -pub const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD: DWORD = 8585; -pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2: DWORD = 8586; -pub const ERROR_DS_THREAD_LIMIT_EXCEEDED: DWORD = 8587; -pub const ERROR_DS_NOT_CLOSEST: DWORD = 8588; -pub const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF: DWORD = 8589; -pub const ERROR_DS_SINGLE_USER_MODE_FAILED: DWORD = 8590; -pub const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR: DWORD = 8591; -pub const ERROR_DS_NTDSCRIPT_PROCESS_ERROR: DWORD = 8592; -pub const ERROR_DS_DIFFERENT_REPL_EPOCHS: DWORD = 8593; -pub const ERROR_DS_DRS_EXTENSIONS_CHANGED: DWORD = 8594; -pub const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR: DWORD = 8595; -pub const ERROR_DS_NO_MSDS_INTID: DWORD = 8596; -pub const ERROR_DS_DUP_MSDS_INTID: DWORD = 8597; -pub const ERROR_DS_EXISTS_IN_RDNATTID: DWORD = 8598; -pub const ERROR_DS_AUTHORIZATION_FAILED: DWORD = 8599; -pub const ERROR_DS_INVALID_SCRIPT: DWORD = 8600; -pub const ERROR_DS_REMOTE_CROSSREF_OP_FAILED: DWORD = 8601; -pub const ERROR_DS_CROSS_REF_BUSY: DWORD = 8602; -pub const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN: DWORD = 8603; -pub const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC: DWORD = 8604; -pub const ERROR_DS_DUPLICATE_ID_FOUND: DWORD = 8605; -pub const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT: DWORD = 8606; -pub const ERROR_DS_GROUP_CONVERSION_ERROR: DWORD = 8607; -pub const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP: DWORD = 8608; -pub const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP: DWORD = 8609; -pub const ERROR_DS_ROLE_NOT_VERIFIED: DWORD = 8610; -pub const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL: DWORD = 8611; -pub const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS: DWORD = 8612; -pub const ERROR_DS_EXISTING_AD_CHILD_NC: DWORD = 8613; -pub const ERROR_DS_REPL_LIFETIME_EXCEEDED: DWORD = 8614; -pub const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER: DWORD = 8615; -pub const ERROR_DS_LDAP_SEND_QUEUE_FULL: DWORD = 8616; -pub const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW: DWORD = 8617; -pub const ERROR_SXS_SECTION_NOT_FOUND: DWORD = 14000; -pub const ERROR_SXS_CANT_GEN_ACTCTX: DWORD = 14001; -pub const ERROR_SXS_INVALID_ACTCTXDATA_FORMAT: DWORD = 14002; -pub const ERROR_SXS_ASSEMBLY_NOT_FOUND: DWORD = 14003; -pub const ERROR_SXS_MANIFEST_FORMAT_ERROR: DWORD = 14004; -pub const ERROR_SXS_MANIFEST_PARSE_ERROR: DWORD = 14005; -pub const ERROR_SXS_ACTIVATION_CONTEXT_DISABLED: DWORD = 14006; -pub const ERROR_SXS_KEY_NOT_FOUND: DWORD = 14007; -pub const ERROR_SXS_VERSION_CONFLICT: DWORD = 14008; -pub const ERROR_SXS_WRONG_SECTION_TYPE: DWORD = 14009; -pub const ERROR_SXS_THREAD_QUERIES_DISABLED: DWORD = 14010; -pub const ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET: DWORD = 14011; -pub const ERROR_SXS_UNKNOWN_ENCODING_GROUP: DWORD = 14012; -pub const ERROR_SXS_UNKNOWN_ENCODING: DWORD = 14013; -pub const ERROR_SXS_INVALID_XML_NAMESPACE_URI: DWORD = 14014; -pub const ERROR_SXS_ROOT_MANIFEST_DEPENDENCY_NOT_INSTALLED: DWORD = 14015; -pub const ERROR_SXS_LEAF_MANIFEST_DEPENDENCY_NOT_INSTALLED: DWORD = 14016; -pub const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE: DWORD = 14017; -pub const ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE: DWORD = 14018; -pub const ERROR_SXS_MANIFEST_INVALID_REQUIRED_DEFAULT_NAMESPACE: DWORD = 14019; -pub const ERROR_SXS_PRIVATE_MANIFEST_CROSS_PATH_WITH_REPARSE_POINT: DWORD = 14020; -pub const ERROR_SXS_DUPLICATE_DLL_NAME: DWORD = 14021; -pub const ERROR_SXS_DUPLICATE_WINDOWCLASS_NAME: DWORD = 14022; -pub const ERROR_SXS_DUPLICATE_CLSID: DWORD = 14023; -pub const ERROR_SXS_DUPLICATE_IID: DWORD = 14024; -pub const ERROR_SXS_DUPLICATE_TLBID: DWORD = 14025; -pub const ERROR_SXS_DUPLICATE_PROGID: DWORD = 14026; -pub const ERROR_SXS_DUPLICATE_ASSEMBLY_NAME: DWORD = 14027; -pub const ERROR_SXS_FILE_HASH_MISMATCH: DWORD = 14028; -pub const ERROR_SXS_POLICY_PARSE_ERROR: DWORD = 14029; -pub const ERROR_SXS_XML_E_MISSINGQUOTE: DWORD = 14030; -pub const ERROR_SXS_XML_E_COMMENTSYNTAX: DWORD = 14031; -pub const ERROR_SXS_XML_E_BADSTARTNAMECHAR: DWORD = 14032; -pub const ERROR_SXS_XML_E_BADNAMECHAR: DWORD = 14033; -pub const ERROR_SXS_XML_E_BADCHARINSTRING: DWORD = 14034; -pub const ERROR_SXS_XML_E_XMLDECLSYNTAX: DWORD = 14035; -pub const ERROR_SXS_XML_E_BADCHARDATA: DWORD = 14036; -pub const ERROR_SXS_XML_E_MISSINGWHITESPACE: DWORD = 14037; -pub const ERROR_SXS_XML_E_EXPECTINGTAGEND: DWORD = 14038; -pub const ERROR_SXS_XML_E_MISSINGSEMICOLON: DWORD = 14039; -pub const ERROR_SXS_XML_E_UNBALANCEDPAREN: DWORD = 14040; -pub const ERROR_SXS_XML_E_INTERNALERROR: DWORD = 14041; -pub const ERROR_SXS_XML_E_UNEXPECTED_WHITESPACE: DWORD = 14042; -pub const ERROR_SXS_XML_E_INCOMPLETE_ENCODING: DWORD = 14043; -pub const ERROR_SXS_XML_E_MISSING_PAREN: DWORD = 14044; -pub const ERROR_SXS_XML_E_EXPECTINGCLOSEQUOTE: DWORD = 14045; -pub const ERROR_SXS_XML_E_MULTIPLE_COLONS: DWORD = 14046; -pub const ERROR_SXS_XML_E_INVALID_DECIMAL: DWORD = 14047; -pub const ERROR_SXS_XML_E_INVALID_HEXIDECIMAL: DWORD = 14048; -pub const ERROR_SXS_XML_E_INVALID_UNICODE: DWORD = 14049; -pub const ERROR_SXS_XML_E_WHITESPACEORQUESTIONMARK: DWORD = 14050; -pub const ERROR_SXS_XML_E_UNEXPECTEDENDTAG: DWORD = 14051; -pub const ERROR_SXS_XML_E_UNCLOSEDTAG: DWORD = 14052; -pub const ERROR_SXS_XML_E_DUPLICATEATTRIBUTE: DWORD = 14053; -pub const ERROR_SXS_XML_E_MULTIPLEROOTS: DWORD = 14054; -pub const ERROR_SXS_XML_E_INVALIDATROOTLEVEL: DWORD = 14055; -pub const ERROR_SXS_XML_E_BADXMLDECL: DWORD = 14056; -pub const ERROR_SXS_XML_E_MISSINGROOT: DWORD = 14057; -pub const ERROR_SXS_XML_E_UNEXPECTEDEOF: DWORD = 14058; -pub const ERROR_SXS_XML_E_BADPEREFINSUBSET: DWORD = 14059; -pub const ERROR_SXS_XML_E_UNCLOSEDSTARTTAG: DWORD = 14060; -pub const ERROR_SXS_XML_E_UNCLOSEDENDTAG: DWORD = 14061; -pub const ERROR_SXS_XML_E_UNCLOSEDSTRING: DWORD = 14062; -pub const ERROR_SXS_XML_E_UNCLOSEDCOMMENT: DWORD = 14063; -pub const ERROR_SXS_XML_E_UNCLOSEDDECL: DWORD = 14064; -pub const ERROR_SXS_XML_E_UNCLOSEDCDATA: DWORD = 14065; -pub const ERROR_SXS_XML_E_RESERVEDNAMESPACE: DWORD = 14066; -pub const ERROR_SXS_XML_E_INVALIDENCODING: DWORD = 14067; -pub const ERROR_SXS_XML_E_INVALIDSWITCH: DWORD = 14068; -pub const ERROR_SXS_XML_E_BADXMLCASE: DWORD = 14069; -pub const ERROR_SXS_XML_E_INVALID_STANDALONE: DWORD = 14070; -pub const ERROR_SXS_XML_E_UNEXPECTED_STANDALONE: DWORD = 14071; -pub const ERROR_SXS_XML_E_INVALID_VERSION: DWORD = 14072; -pub const ERROR_SXS_XML_E_MISSINGEQUALS: DWORD = 14073; -pub const ERROR_SXS_PROTECTION_RECOVERY_FAILED: DWORD = 14074; -pub const ERROR_SXS_PROTECTION_PUBLIC_KEY_TOO_SHORT: DWORD = 14075; -pub const ERROR_SXS_PROTECTION_CATALOG_NOT_VALID: DWORD = 14076; -pub const ERROR_SXS_UNTRANSLATABLE_HRESULT: DWORD = 14077; -pub const ERROR_SXS_PROTECTION_CATALOG_FILE_MISSING: DWORD = 14078; -pub const ERROR_SXS_MISSING_ASSEMBLY_IDENTITY_ATTRIBUTE: DWORD = 14079; -pub const ERROR_SXS_INVALID_ASSEMBLY_IDENTITY_ATTRIBUTE_NAME: DWORD = 14080; -pub const ERROR_SXS_ASSEMBLY_MISSING: DWORD = 14081; -pub const ERROR_SXS_CORRUPT_ACTIVATION_STACK: DWORD = 14082; -pub const ERROR_SXS_CORRUPTION: DWORD = 14083; -pub const ERROR_SXS_EARLY_DEACTIVATION: DWORD = 14084; -pub const ERROR_SXS_INVALID_DEACTIVATION: DWORD = 14085; -pub const ERROR_SXS_MULTIPLE_DEACTIVATION: DWORD = 14086; -pub const ERROR_SXS_PROCESS_TERMINATION_REQUESTED: DWORD = 14087; -pub const ERROR_SXS_RELEASE_ACTIVATION_CONTEXT: DWORD = 14088; -pub const ERROR_SXS_SYSTEM_DEFAULT_ACTIVATION_CONTEXT_EMPTY: DWORD = 14089; -pub const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_VALUE: DWORD = 14090; -pub const ERROR_SXS_INVALID_IDENTITY_ATTRIBUTE_NAME: DWORD = 14091; -pub const ERROR_SXS_IDENTITY_DUPLICATE_ATTRIBUTE: DWORD = 14092; -pub const ERROR_SXS_IDENTITY_PARSE_ERROR: DWORD = 14093; -pub const ERROR_MALFORMED_SUBSTITUTION_STRING: DWORD = 14094; -pub const ERROR_SXS_INCORRECT_PUBLIC_KEY_TOKEN: DWORD = 14095; -pub const ERROR_UNMAPPED_SUBSTITUTION_STRING: DWORD = 14096; -pub const ERROR_SXS_ASSEMBLY_NOT_LOCKED: DWORD = 14097; -pub const ERROR_SXS_COMPONENT_STORE_CORRUPT: DWORD = 14098; -pub const ERROR_ADVANCED_INSTALLER_FAILED: DWORD = 14099; -pub const ERROR_XML_ENCODING_MISMATCH: DWORD = 14100; -pub const ERROR_SXS_MANIFEST_IDENTITY_SAME_BUT_CONTENTS_DIFFERENT: DWORD = 14101; -pub const ERROR_SXS_IDENTITIES_DIFFERENT: DWORD = 14102; -pub const ERROR_SXS_ASSEMBLY_IS_NOT_A_DEPLOYMENT: DWORD = 14103; -pub const ERROR_SXS_FILE_NOT_PART_OF_ASSEMBLY: DWORD = 14104; -pub const ERROR_SXS_MANIFEST_TOO_BIG: DWORD = 14105; -pub const ERROR_SXS_SETTING_NOT_REGISTERED: DWORD = 14106; -pub const ERROR_SXS_TRANSACTION_CLOSURE_INCOMPLETE: DWORD = 14107; -pub const ERROR_SMI_PRIMITIVE_INSTALLER_FAILED: DWORD = 14108; -pub const ERROR_GENERIC_COMMAND_FAILED: DWORD = 14109; -pub const ERROR_SXS_FILE_HASH_MISSING: DWORD = 14110; -pub const ERROR_IPSEC_QM_POLICY_EXISTS: DWORD = 13000; -pub const ERROR_IPSEC_QM_POLICY_NOT_FOUND: DWORD = 13001; -pub const ERROR_IPSEC_QM_POLICY_IN_USE: DWORD = 13002; -pub const ERROR_IPSEC_MM_POLICY_EXISTS: DWORD = 13003; -pub const ERROR_IPSEC_MM_POLICY_NOT_FOUND: DWORD = 13004; -pub const ERROR_IPSEC_MM_POLICY_IN_USE: DWORD = 13005; -pub const ERROR_IPSEC_MM_FILTER_EXISTS: DWORD = 13006; -pub const ERROR_IPSEC_MM_FILTER_NOT_FOUND: DWORD = 13007; -pub const ERROR_IPSEC_TRANSPORT_FILTER_EXISTS: DWORD = 13008; -pub const ERROR_IPSEC_TRANSPORT_FILTER_NOT_FOUND: DWORD = 13009; -pub const ERROR_IPSEC_MM_AUTH_EXISTS: DWORD = 13010; -pub const ERROR_IPSEC_MM_AUTH_NOT_FOUND: DWORD = 13011; -pub const ERROR_IPSEC_MM_AUTH_IN_USE: DWORD = 13012; -pub const ERROR_IPSEC_DEFAULT_MM_POLICY_NOT_FOUND: DWORD = 13013; -pub const ERROR_IPSEC_DEFAULT_MM_AUTH_NOT_FOUND: DWORD = 13014; -pub const ERROR_IPSEC_DEFAULT_QM_POLICY_NOT_FOUND: DWORD = 13015; -pub const ERROR_IPSEC_TUNNEL_FILTER_EXISTS: DWORD = 13016; -pub const ERROR_IPSEC_TUNNEL_FILTER_NOT_FOUND: DWORD = 13017; -pub const ERROR_IPSEC_MM_FILTER_PENDING_DELETION: DWORD = 13018; -pub const ERROR_IPSEC_TRANSPORT_FILTER_PENDING_DELETION: DWORD = 13019; -pub const ERROR_IPSEC_TUNNEL_FILTER_PENDING_DELETION: DWORD = 13020; -pub const ERROR_IPSEC_MM_POLICY_PENDING_DELETION: DWORD = 13021; -pub const ERROR_IPSEC_MM_AUTH_PENDING_DELETION: DWORD = 13022; -pub const ERROR_IPSEC_QM_POLICY_PENDING_DELETION: DWORD = 13023; -pub const ERROR_IPSEC_IKE_NEG_STATUS_BEGIN: DWORD = 13800; -pub const ERROR_IPSEC_IKE_AUTH_FAIL: DWORD = 13801; -pub const ERROR_IPSEC_IKE_ATTRIB_FAIL: DWORD = 13802; -pub const ERROR_IPSEC_IKE_NEGOTIATION_PENDING: DWORD = 13803; -pub const ERROR_IPSEC_IKE_GENERAL_PROCESSING_ERROR: DWORD = 13804; -pub const ERROR_IPSEC_IKE_TIMED_OUT: DWORD = 13805; -pub const ERROR_IPSEC_IKE_NO_CERT: DWORD = 13806; -pub const ERROR_IPSEC_IKE_SA_DELETED: DWORD = 13807; -pub const ERROR_IPSEC_IKE_SA_REAPED: DWORD = 13808; -pub const ERROR_IPSEC_IKE_MM_ACQUIRE_DROP: DWORD = 13809; -pub const ERROR_IPSEC_IKE_QM_ACQUIRE_DROP: DWORD = 13810; -pub const ERROR_IPSEC_IKE_QUEUE_DROP_MM: DWORD = 13811; -pub const ERROR_IPSEC_IKE_QUEUE_DROP_NO_MM: DWORD = 13812; -pub const ERROR_IPSEC_IKE_DROP_NO_RESPONSE: DWORD = 13813; -pub const ERROR_IPSEC_IKE_MM_DELAY_DROP: DWORD = 13814; -pub const ERROR_IPSEC_IKE_QM_DELAY_DROP: DWORD = 13815; -pub const ERROR_IPSEC_IKE_ERROR: DWORD = 13816; -pub const ERROR_IPSEC_IKE_CRL_FAILED: DWORD = 13817; -pub const ERROR_IPSEC_IKE_INVALID_KEY_USAGE: DWORD = 13818; -pub const ERROR_IPSEC_IKE_INVALID_CERT_TYPE: DWORD = 13819; -pub const ERROR_IPSEC_IKE_NO_PRIVATE_KEY: DWORD = 13820; -pub const ERROR_IPSEC_IKE_DH_FAIL: DWORD = 13822; -pub const ERROR_IPSEC_IKE_INVALID_HEADER: DWORD = 13824; -pub const ERROR_IPSEC_IKE_NO_POLICY: DWORD = 13825; -pub const ERROR_IPSEC_IKE_INVALID_SIGNATURE: DWORD = 13826; -pub const ERROR_IPSEC_IKE_KERBEROS_ERROR: DWORD = 13827; -pub const ERROR_IPSEC_IKE_NO_PUBLIC_KEY: DWORD = 13828; -pub const ERROR_IPSEC_IKE_PROCESS_ERR: DWORD = 13829; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_SA: DWORD = 13830; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_PROP: DWORD = 13831; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_TRANS: DWORD = 13832; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_KE: DWORD = 13833; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_ID: DWORD = 13834; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_CERT: DWORD = 13835; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_CERT_REQ: DWORD = 13836; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_HASH: DWORD = 13837; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_SIG: DWORD = 13838; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_NONCE: DWORD = 13839; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_NOTIFY: DWORD = 13840; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_DELETE: DWORD = 13841; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_VENDOR: DWORD = 13842; -pub const ERROR_IPSEC_IKE_INVALID_PAYLOAD: DWORD = 13843; -pub const ERROR_IPSEC_IKE_LOAD_SOFT_SA: DWORD = 13844; -pub const ERROR_IPSEC_IKE_SOFT_SA_TORN_DOWN: DWORD = 13845; -pub const ERROR_IPSEC_IKE_INVALID_COOKIE: DWORD = 13846; -pub const ERROR_IPSEC_IKE_NO_PEER_CERT: DWORD = 13847; -pub const ERROR_IPSEC_IKE_PEER_CRL_FAILED: DWORD = 13848; -pub const ERROR_IPSEC_IKE_POLICY_CHANGE: DWORD = 13849; -pub const ERROR_IPSEC_IKE_NO_MM_POLICY: DWORD = 13850; -pub const ERROR_IPSEC_IKE_NOTCBPRIV: DWORD = 13851; -pub const ERROR_IPSEC_IKE_SECLOADFAIL: DWORD = 13852; -pub const ERROR_IPSEC_IKE_FAILSSPINIT: DWORD = 13853; -pub const ERROR_IPSEC_IKE_FAILQUERYSSP: DWORD = 13854; -pub const ERROR_IPSEC_IKE_SRVACQFAIL: DWORD = 13855; -pub const ERROR_IPSEC_IKE_SRVQUERYCRED: DWORD = 13856; -pub const ERROR_IPSEC_IKE_GETSPIFAIL: DWORD = 13857; -pub const ERROR_IPSEC_IKE_INVALID_FILTER: DWORD = 13858; -pub const ERROR_IPSEC_IKE_OUT_OF_MEMORY: DWORD = 13859; -pub const ERROR_IPSEC_IKE_ADD_UPDATE_KEY_FAILED: DWORD = 13860; -pub const ERROR_IPSEC_IKE_INVALID_POLICY: DWORD = 13861; -pub const ERROR_IPSEC_IKE_UNKNOWN_DOI: DWORD = 13862; -pub const ERROR_IPSEC_IKE_INVALID_SITUATION: DWORD = 13863; -pub const ERROR_IPSEC_IKE_DH_FAILURE: DWORD = 13864; -pub const ERROR_IPSEC_IKE_INVALID_GROUP: DWORD = 13865; -pub const ERROR_IPSEC_IKE_ENCRYPT: DWORD = 13866; -pub const ERROR_IPSEC_IKE_DECRYPT: DWORD = 13867; -pub const ERROR_IPSEC_IKE_POLICY_MATCH: DWORD = 13868; -pub const ERROR_IPSEC_IKE_UNSUPPORTED_ID: DWORD = 13869; -pub const ERROR_IPSEC_IKE_INVALID_HASH: DWORD = 13870; -pub const ERROR_IPSEC_IKE_INVALID_HASH_ALG: DWORD = 13871; -pub const ERROR_IPSEC_IKE_INVALID_HASH_SIZE: DWORD = 13872; -pub const ERROR_IPSEC_IKE_INVALID_ENCRYPT_ALG: DWORD = 13873; -pub const ERROR_IPSEC_IKE_INVALID_AUTH_ALG: DWORD = 13874; -pub const ERROR_IPSEC_IKE_INVALID_SIG: DWORD = 13875; -pub const ERROR_IPSEC_IKE_LOAD_FAILED: DWORD = 13876; -pub const ERROR_IPSEC_IKE_RPC_DELETE: DWORD = 13877; -pub const ERROR_IPSEC_IKE_BENIGN_REINIT: DWORD = 13878; -pub const ERROR_IPSEC_IKE_INVALID_RESPONDER_LIFETIME_NOTIFY: DWORD = 13879; -pub const ERROR_IPSEC_IKE_INVALID_CERT_KEYLEN: DWORD = 13881; -pub const ERROR_IPSEC_IKE_MM_LIMIT: DWORD = 13882; -pub const ERROR_IPSEC_IKE_NEGOTIATION_DISABLED: DWORD = 13883; -/*pub const ERROR_IPSEC_IKE_NEG_STATUS_END: DWORD = 13884)*/ -pub const ERROR_IPSEC_IKE_QM_LIMIT: DWORD = 13884; -pub const ERROR_IPSEC_IKE_MM_EXPIRED: DWORD = 13885; -pub const ERROR_IPSEC_IKE_PEER_MM_ASSUMED_INVALID: DWORD = 13886; -pub const ERROR_IPSEC_IKE_CERT_CHAIN_POLICY_MISMATCH: DWORD = 13887; -pub const ERROR_IPSEC_IKE_UNEXPECTED_MESSAGE_ID: DWORD = 13888; -pub const ERROR_IPSEC_IKE_INVALID_AUTH_PAYLOAD: DWORD = 13889; -pub const ERROR_IPSEC_IKE_DOS_COOKIE_SENT: DWORD = 13890; -pub const ERROR_IPSEC_IKE_SHUTTING_DOWN: DWORD = 13891; -pub const ERROR_IPSEC_IKE_CGA_AUTH_FAILED: DWORD = 13892; -pub const ERROR_IPSEC_IKE_PROCESS_ERR_NATOA: DWORD = 13893; -pub const ERROR_IPSEC_IKE_INVALID_MM_FOR_QM: DWORD = 13894; -pub const ERROR_IPSEC_IKE_QM_EXPIRED: DWORD = 13895; -pub const ERROR_IPSEC_IKE_TOO_MANY_FILTERS: DWORD = 13896; -pub const ERROR_IPSEC_IKE_NEG_STATUS_END: DWORD = 13897; -pub const ERROR_IPSEC_IKE_KILL_DUMMY_NAP_TUNNEL: DWORD = 13898; -pub const ERROR_IPSEC_IKE_INNER_IP_ASSIGNMENT_FAILURE: DWORD = 13899; -pub const ERROR_IPSEC_IKE_REQUIRE_CP_PAYLOAD_MISSING: DWORD = 13900; -pub const ERROR_IPSEC_KEY_MODULE_IMPERSONATION_NEGOTIATION_PENDING: DWORD = 13901; -pub const ERROR_IPSEC_IKE_COEXISTENCE_SUPPRESS: DWORD = 13902; -pub const ERROR_IPSEC_IKE_RATELIMIT_DROP: DWORD = 13903; -pub const ERROR_IPSEC_IKE_PEER_DOESNT_SUPPORT_MOBIKE: DWORD = 13904; -pub const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE: DWORD = 13905; -pub const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_FAILURE: DWORD = 13906; -pub const ERROR_IPSEC_IKE_AUTHORIZATION_FAILURE_WITH_OPTIONAL_RETRY: DWORD = 13907; -pub const ERROR_IPSEC_IKE_STRONG_CRED_AUTHORIZATION_AND_CERTMAP_FAILURE: DWORD = 13908; -pub const ERROR_IPSEC_IKE_NEG_STATUS_EXTENDED_END: DWORD = 13909; -pub const ERROR_IPSEC_BAD_SPI: DWORD = 13910; -pub const ERROR_IPSEC_SA_LIFETIME_EXPIRED: DWORD = 13911; -pub const ERROR_IPSEC_WRONG_SA: DWORD = 13912; -pub const ERROR_IPSEC_REPLAY_CHECK_FAILED: DWORD = 13913; -pub const ERROR_IPSEC_INVALID_PACKET: DWORD = 13914; -pub const ERROR_IPSEC_INTEGRITY_CHECK_FAILED: DWORD = 13915; -pub const ERROR_IPSEC_CLEAR_TEXT_DROP: DWORD = 13916; -pub const ERROR_IPSEC_AUTH_FIREWALL_DROP: DWORD = 13917; -pub const ERROR_IPSEC_THROTTLE_DROP: DWORD = 13918; -pub const ERROR_IPSEC_DOSP_BLOCK: DWORD = 13925; -pub const ERROR_IPSEC_DOSP_RECEIVED_MULTICAST: DWORD = 13926; -pub const ERROR_IPSEC_DOSP_INVALID_PACKET: DWORD = 13927; -pub const ERROR_IPSEC_DOSP_STATE_LOOKUP_FAILED: DWORD = 13928; -pub const ERROR_IPSEC_DOSP_MAX_ENTRIES: DWORD = 13929; -pub const ERROR_IPSEC_DOSP_KEYMOD_NOT_ALLOWED: DWORD = 13930; -pub const ERROR_IPSEC_DOSP_NOT_INSTALLED: DWORD = 13931; -pub const ERROR_IPSEC_DOSP_MAX_PER_IP_RATELIMIT_QUEUES: DWORD = 13932; -pub const ERROR_EVT_INVALID_CHANNEL_PATH: DWORD = 15000; -pub const ERROR_EVT_INVALID_QUERY: DWORD = 15001; -pub const ERROR_EVT_PUBLISHER_METADATA_NOT_FOUND: DWORD = 15002; -pub const ERROR_EVT_EVENT_TEMPLATE_NOT_FOUND: DWORD = 15003; -pub const ERROR_EVT_INVALID_PUBLISHER_NAME: DWORD = 15004; -pub const ERROR_EVT_INVALID_EVENT_DATA: DWORD = 15005; -pub const ERROR_EVT_CHANNEL_NOT_FOUND: DWORD = 15007; -pub const ERROR_EVT_MALFORMED_XML_TEXT: DWORD = 15008; -pub const ERROR_EVT_SUBSCRIPTION_TO_DIRECT_CHANNEL: DWORD = 15009; -pub const ERROR_EVT_CONFIGURATION_ERROR: DWORD = 15010; -pub const ERROR_EVT_QUERY_RESULT_STALE: DWORD = 15011; -pub const ERROR_EVT_QUERY_RESULT_INVALID_POSITION: DWORD = 15012; -pub const ERROR_EVT_NON_VALIDATING_MSXML: DWORD = 15013; -pub const ERROR_EVT_FILTER_ALREADYSCOPED: DWORD = 15014; -pub const ERROR_EVT_FILTER_NOTELTSET: DWORD = 15015; -pub const ERROR_EVT_FILTER_INVARG: DWORD = 15016; -pub const ERROR_EVT_FILTER_INVTEST: DWORD = 15017; -pub const ERROR_EVT_FILTER_INVTYPE: DWORD = 15018; -pub const ERROR_EVT_FILTER_PARSEERR: DWORD = 15019; -pub const ERROR_EVT_FILTER_UNSUPPORTEDOP: DWORD = 15020; -pub const ERROR_EVT_FILTER_UNEXPECTEDTOKEN: DWORD = 15021; -pub const ERROR_EVT_INVALID_OPERATION_OVER_ENABLED_DIRECT_CHANNEL: DWORD = 15022; -pub const ERROR_EVT_INVALID_CHANNEL_PROPERTY_VALUE: DWORD = 15023; -pub const ERROR_EVT_INVALID_PUBLISHER_PROPERTY_VALUE: DWORD = 15024; -pub const ERROR_EVT_CHANNEL_CANNOT_ACTIVATE: DWORD = 15025; -pub const ERROR_EVT_FILTER_TOO_COMPLEX: DWORD = 15026; -pub const ERROR_EVT_MESSAGE_NOT_FOUND: DWORD = 15027; -pub const ERROR_EVT_MESSAGE_ID_NOT_FOUND: DWORD = 15028; -pub const ERROR_EVT_UNRESOLVED_VALUE_INSERT: DWORD = 15029; -pub const ERROR_EVT_UNRESOLVED_PARAMETER_INSERT: DWORD = 15030; -pub const ERROR_EVT_MAX_INSERTS_REACHED: DWORD = 15031; -pub const ERROR_EVT_EVENT_DEFINITION_NOT_FOUND: DWORD = 15032; -pub const ERROR_EVT_MESSAGE_LOCALE_NOT_FOUND: DWORD = 15033; -pub const ERROR_EVT_VERSION_TOO_OLD: DWORD = 15034; -pub const ERROR_EVT_VERSION_TOO_NEW: DWORD = 15035; -pub const ERROR_EVT_CANNOT_OPEN_CHANNEL_OF_QUERY: DWORD = 15036; -pub const ERROR_EVT_PUBLISHER_DISABLED: DWORD = 15037; -pub const ERROR_EVT_FILTER_OUT_OF_RANGE: DWORD = 15038; -pub const ERROR_EC_SUBSCRIPTION_CANNOT_ACTIVATE: DWORD = 15080; -pub const ERROR_EC_LOG_DISABLED: DWORD = 15081; -pub const ERROR_EC_CIRCULAR_FORWARDING: DWORD = 15082; -pub const ERROR_EC_CREDSTORE_FULL: DWORD = 15083; -pub const ERROR_EC_CRED_NOT_FOUND: DWORD = 15084; -pub const ERROR_EC_NO_ACTIVE_CHANNEL: DWORD = 15085; -pub const ERROR_MUI_FILE_NOT_FOUND: DWORD = 15100; -pub const ERROR_MUI_INVALID_FILE: DWORD = 15101; -pub const ERROR_MUI_INVALID_RC_CONFIG: DWORD = 15102; -pub const ERROR_MUI_INVALID_LOCALE_NAME: DWORD = 15103; -pub const ERROR_MUI_INVALID_ULTIMATEFALLBACK_NAME: DWORD = 15104; -pub const ERROR_MUI_FILE_NOT_LOADED: DWORD = 15105; -pub const ERROR_RESOURCE_ENUM_USER_STOP: DWORD = 15106; -pub const ERROR_MUI_INTLSETTINGS_UILANG_NOT_INSTALLED: DWORD = 15107; -pub const ERROR_MUI_INTLSETTINGS_INVALID_LOCALE_NAME: DWORD = 15108; -pub const ERROR_MRM_RUNTIME_NO_DEFAULT_OR_NEUTRAL_RESOURCE: DWORD = 15110; -pub const ERROR_MRM_INVALID_PRICONFIG: DWORD = 15111; -pub const ERROR_MRM_INVALID_FILE_TYPE: DWORD = 15112; -pub const ERROR_MRM_UNKNOWN_QUALIFIER: DWORD = 15113; -pub const ERROR_MRM_INVALID_QUALIFIER_VALUE: DWORD = 15114; -pub const ERROR_MRM_NO_CANDIDATE: DWORD = 15115; -pub const ERROR_MRM_NO_MATCH_OR_DEFAULT_CANDIDATE: DWORD = 15116; -pub const ERROR_MRM_RESOURCE_TYPE_MISMATCH: DWORD = 15117; -pub const ERROR_MRM_DUPLICATE_MAP_NAME: DWORD = 15118; -pub const ERROR_MRM_DUPLICATE_ENTRY: DWORD = 15119; -pub const ERROR_MRM_INVALID_RESOURCE_IDENTIFIER: DWORD = 15120; -pub const ERROR_MRM_FILEPATH_TOO_LONG: DWORD = 15121; -pub const ERROR_MRM_UNSUPPORTED_DIRECTORY_TYPE: DWORD = 15122; -pub const ERROR_MRM_INVALID_PRI_FILE: DWORD = 15126; -pub const ERROR_MRM_NAMED_RESOURCE_NOT_FOUND: DWORD = 15127; -pub const ERROR_MRM_MAP_NOT_FOUND: DWORD = 15135; -pub const ERROR_MRM_UNSUPPORTED_PROFILE_TYPE: DWORD = 15136; -pub const ERROR_MRM_INVALID_QUALIFIER_OPERATOR: DWORD = 15137; -pub const ERROR_MRM_INDETERMINATE_QUALIFIER_VALUE: DWORD = 15138; -pub const ERROR_MRM_AUTOMERGE_ENABLED: DWORD = 15139; -pub const ERROR_MRM_TOO_MANY_RESOURCES: DWORD = 15140; -pub const ERROR_MCA_INVALID_CAPABILITIES_STRING: DWORD = 15200; -pub const ERROR_MCA_INVALID_VCP_VERSION: DWORD = 15201; -pub const ERROR_MCA_MONITOR_VIOLATES_MCCS_SPECIFICATION: DWORD = 15202; -pub const ERROR_MCA_MCCS_VERSION_MISMATCH: DWORD = 15203; -pub const ERROR_MCA_UNSUPPORTED_MCCS_VERSION: DWORD = 15204; -pub const ERROR_MCA_INTERNAL_ERROR: DWORD = 15205; -pub const ERROR_MCA_INVALID_TECHNOLOGY_TYPE_RETURNED: DWORD = 15206; -pub const ERROR_MCA_UNSUPPORTED_COLOR_TEMPERATURE: DWORD = 15207; -pub const ERROR_AMBIGUOUS_SYSTEM_DEVICE: DWORD = 15250; -pub const ERROR_SYSTEM_DEVICE_NOT_FOUND: DWORD = 15299; -pub const ERROR_HASH_NOT_SUPPORTED: DWORD = 15300; -pub const ERROR_HASH_NOT_PRESENT: DWORD = 15301; -pub const ERROR_SECONDARY_IC_PROVIDER_NOT_REGISTERED: DWORD = 15321; -pub const ERROR_GPIO_CLIENT_INFORMATION_INVALID: DWORD = 15322; -pub const ERROR_GPIO_VERSION_NOT_SUPPORTED: DWORD = 15323; -pub const ERROR_GPIO_INVALID_REGISTRATION_PACKET: DWORD = 15324; -pub const ERROR_GPIO_OPERATION_DENIED: DWORD = 15325; -pub const ERROR_GPIO_INCOMPATIBLE_CONNECT_MODE: DWORD = 15326; -pub const ERROR_GPIO_INTERRUPT_ALREADY_UNMASKED: DWORD = 15327; -pub const ERROR_CANNOT_SWITCH_RUNLEVEL: DWORD = 15400; -pub const ERROR_INVALID_RUNLEVEL_SETTING: DWORD = 15401; -pub const ERROR_RUNLEVEL_SWITCH_TIMEOUT: DWORD = 15402; -pub const ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT: DWORD = 15403; -pub const ERROR_RUNLEVEL_SWITCH_IN_PROGRESS: DWORD = 15404; -pub const ERROR_SERVICES_FAILED_AUTOSTART: DWORD = 15405; -pub const ERROR_COM_TASK_STOP_PENDING: DWORD = 15501; -pub const ERROR_INSTALL_OPEN_PACKAGE_FAILED: DWORD = 15600; -pub const ERROR_INSTALL_PACKAGE_NOT_FOUND: DWORD = 15601; -pub const ERROR_INSTALL_INVALID_PACKAGE: DWORD = 15602; -pub const ERROR_INSTALL_RESOLVE_DEPENDENCY_FAILED: DWORD = 15603; -pub const ERROR_INSTALL_OUT_OF_DISK_SPACE: DWORD = 15604; -pub const ERROR_INSTALL_NETWORK_FAILURE: DWORD = 15605; -pub const ERROR_INSTALL_REGISTRATION_FAILURE: DWORD = 15606; -pub const ERROR_INSTALL_DEREGISTRATION_FAILURE: DWORD = 15607; -pub const ERROR_INSTALL_CANCEL: DWORD = 15608; -pub const ERROR_INSTALL_FAILED: DWORD = 15609; -pub const ERROR_REMOVE_FAILED: DWORD = 15610; -pub const ERROR_PACKAGE_ALREADY_EXISTS: DWORD = 15611; -pub const ERROR_NEEDS_REMEDIATION: DWORD = 15612; -pub const ERROR_INSTALL_PREREQUISITE_FAILED: DWORD = 15613; -pub const ERROR_PACKAGE_REPOSITORY_CORRUPTED: DWORD = 15614; -pub const ERROR_INSTALL_POLICY_FAILURE: DWORD = 15615; -pub const ERROR_PACKAGE_UPDATING: DWORD = 15616; -pub const ERROR_DEPLOYMENT_BLOCKED_BY_POLICY: DWORD = 15617; -pub const ERROR_PACKAGES_IN_USE: DWORD = 15618; -pub const ERROR_RECOVERY_FILE_CORRUPT: DWORD = 15619; -pub const ERROR_INVALID_STAGED_SIGNATURE: DWORD = 15620; -pub const ERROR_DELETING_EXISTING_APPLICATIONDATA_STORE_FAILED: DWORD = 15621; -pub const ERROR_INSTALL_PACKAGE_DOWNGRADE: DWORD = 15622; -pub const ERROR_SYSTEM_NEEDS_REMEDIATION: DWORD = 15623; -pub const ERROR_APPX_INTEGRITY_FAILURE_CLR_NGEN: DWORD = 15624; -pub const ERROR_RESILIENCY_FILE_CORRUPT: DWORD = 15625; -pub const ERROR_INSTALL_FIREWALL_SERVICE_NOT_RUNNING: DWORD = 15626; -pub const ERROR_STATE_LOAD_STORE_FAILED: DWORD = 15800; -pub const ERROR_STATE_GET_VERSION_FAILED: DWORD = 15801; -pub const ERROR_STATE_SET_VERSION_FAILED: DWORD = 15802; -pub const ERROR_STATE_STRUCTURED_RESET_FAILED: DWORD = 15803; -pub const ERROR_STATE_OPEN_CONTAINER_FAILED: DWORD = 15804; -pub const ERROR_STATE_CREATE_CONTAINER_FAILED: DWORD = 15805; -pub const ERROR_STATE_DELETE_CONTAINER_FAILED: DWORD = 15806; -pub const ERROR_STATE_READ_SETTING_FAILED: DWORD = 15807; -pub const ERROR_STATE_WRITE_SETTING_FAILED: DWORD = 15808; -pub const ERROR_STATE_DELETE_SETTING_FAILED: DWORD = 15809; -pub const ERROR_STATE_QUERY_SETTING_FAILED: DWORD = 15810; -pub const ERROR_STATE_READ_COMPOSITE_SETTING_FAILED: DWORD = 15811; -pub const ERROR_STATE_WRITE_COMPOSITE_SETTING_FAILED: DWORD = 15812; -pub const ERROR_STATE_ENUMERATE_CONTAINER_FAILED: DWORD = 15813; -pub const ERROR_STATE_ENUMERATE_SETTINGS_FAILED: DWORD = 15814; -pub const ERROR_STATE_COMPOSITE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED: DWORD = 15815; -pub const ERROR_STATE_SETTING_VALUE_SIZE_LIMIT_EXCEEDED: DWORD = 15816; -pub const ERROR_STATE_SETTING_NAME_SIZE_LIMIT_EXCEEDED: DWORD = 15817; -pub const ERROR_STATE_CONTAINER_NAME_SIZE_LIMIT_EXCEEDED: DWORD = 15818; -pub const ERROR_API_UNAVAILABLE: DWORD = 15841; -pub const ERROR_AUDITING_DISABLED: DWORD = 0xC0090001; -pub const ERROR_ALL_SIDS_FILTERED: DWORD = 0xC0090002; - -pub const WSABASEERR: c_int = 10000; -pub const WSAEINTR: c_int = WSABASEERR + 4; -pub const WSAEBADF: c_int = WSABASEERR + 9; -pub const WSAEACCES: c_int = WSABASEERR + 13; -pub const WSAEFAULT: c_int = WSABASEERR + 14; -pub const WSAEINVAL: c_int = WSABASEERR + 22; -pub const WSAEMFILE: c_int = WSABASEERR + 24; -pub const WSAEWOULDBLOCK: c_int = WSABASEERR + 35; -pub const WSAEINPROGRESS: c_int = WSABASEERR + 36; -pub const WSAEALREADY: c_int = WSABASEERR + 37; -pub const WSAENOTSOCK: c_int = WSABASEERR + 38; -pub const WSAEDESTADDRREQ: c_int = WSABASEERR + 39; -pub const WSAEMSGSIZE: c_int = WSABASEERR + 40; -pub const WSAEPROTOTYPE: c_int = WSABASEERR + 41; -pub const WSAENOPROTOOPT: c_int = WSABASEERR + 42; -pub const WSAEPROTONOSUPPORT: c_int = WSABASEERR + 43; -pub const WSAESOCKTNOSUPPORT: c_int = WSABASEERR + 44; -pub const WSAEOPNOTSUPP: c_int = WSABASEERR + 45; -pub const WSAEPFNOSUPPORT: c_int = WSABASEERR + 46; -pub const WSAEAFNOSUPPORT: c_int = WSABASEERR + 47; -pub const WSAEADDRINUSE: c_int = WSABASEERR + 48; -pub const WSAEADDRNOTAVAIL: c_int = WSABASEERR + 49; -pub const WSAENETDOWN: c_int = WSABASEERR + 50; -pub const WSAENETUNREACH: c_int = WSABASEERR + 51; -pub const WSAENETRESET: c_int = WSABASEERR + 52; -pub const WSAECONNABORTED: c_int = WSABASEERR + 53; -pub const WSAECONNRESET: c_int = WSABASEERR + 54; -pub const WSAENOBUFS: c_int = WSABASEERR + 55; -pub const WSAEISCONN: c_int = WSABASEERR + 56; -pub const WSAENOTCONN: c_int = WSABASEERR + 57; -pub const WSAESHUTDOWN: c_int = WSABASEERR + 58; -pub const WSAETOOMANYREFS: c_int = WSABASEERR + 59; -pub const WSAETIMEDOUT: c_int = WSABASEERR + 60; -pub const WSAECONNREFUSED: c_int = WSABASEERR + 61; -pub const WSAELOOP: c_int = WSABASEERR + 62; -pub const WSAENAMETOOLONG: c_int = WSABASEERR + 63; -pub const WSAEHOSTDOWN: c_int = WSABASEERR + 64; -pub const WSAEHOSTUNREACH: c_int = WSABASEERR + 65; -pub const WSAENOTEMPTY: c_int = WSABASEERR + 66; -pub const WSAEPROCLIM: c_int = WSABASEERR + 67; -pub const WSAEUSERS: c_int = WSABASEERR + 68; -pub const WSAEDQUOT: c_int = WSABASEERR + 69; -pub const WSAESTALE: c_int = WSABASEERR + 70; -pub const WSAEREMOTE: c_int = WSABASEERR + 71; -pub const WSASYSNOTREADY: c_int = WSABASEERR + 91; -pub const WSAVERNOTSUPPORTED: c_int = WSABASEERR + 92; -pub const WSANOTINITIALISED: c_int = WSABASEERR + 93; -pub const WSAEDISCON: c_int = WSABASEERR + 101; -pub const WSAENOMORE: c_int = WSABASEERR + 102; -pub const WSAECANCELLED: c_int = WSABASEERR + 103; -pub const WSAEINVALIDPROCTABLE: c_int = WSABASEERR + 104; -pub const WSAEINVALIDPROVIDER: c_int = WSABASEERR + 105; -pub const WSAEPROVIDERFAILEDINIT: c_int = WSABASEERR + 106; -pub const WSASYSCALLFAILURE: c_int = WSABASEERR + 107; -pub const WSASERVICE_NOT_FOUND: c_int = WSABASEERR + 108; -pub const WSATYPE_NOT_FOUND: c_int = WSABASEERR + 109; -pub const WSA_E_NO_MORE: c_int = WSABASEERR + 110; -pub const WSA_E_CANCELLED: c_int = WSABASEERR + 111; -pub const WSAEREFUSED: c_int = WSABASEERR + 112; -pub const WSAHOST_NOT_FOUND: c_int = WSABASEERR + 1001; -pub const WSATRY_AGAIN: c_int = WSABASEERR + 1002; -pub const WSANO_RECOVERY: c_int = WSABASEERR + 1003; -pub const WSANO_DATA: c_int = WSABASEERR + 1004; -pub const WSA_QOS_RECEIVERS: c_int = WSABASEERR + 1005; -pub const WSA_QOS_SENDERS: c_int = WSABASEERR + 1006; -pub const WSA_QOS_NO_SENDERS: c_int = WSABASEERR + 1007; -pub const WSA_QOS_NO_RECEIVERS: c_int = WSABASEERR + 1008; -pub const WSA_QOS_REQUEST_CONFIRMED: c_int = WSABASEERR + 1009; -pub const WSA_QOS_ADMISSION_FAILURE: c_int = WSABASEERR + 1010; -pub const WSA_QOS_POLICY_FAILURE: c_int = WSABASEERR + 1011; -pub const WSA_QOS_BAD_STYLE: c_int = WSABASEERR + 1012; -pub const WSA_QOS_BAD_OBJECT: c_int = WSABASEERR + 1013; -pub const WSA_QOS_TRAFFIC_CTRL_ERROR: c_int = WSABASEERR + 1014; -pub const WSA_QOS_GENERIC_ERROR: c_int = WSABASEERR + 1015; -pub const WSA_QOS_ESERVICETYPE: c_int = WSABASEERR + 1016; -pub const WSA_QOS_EFLOWSPEC: c_int = WSABASEERR + 1017; -pub const WSA_QOS_EPROVSPECBUF: c_int = WSABASEERR + 1018; -pub const WSA_QOS_EFILTERSTYLE: c_int = WSABASEERR + 1019; -pub const WSA_QOS_EFILTERTYPE: c_int = WSABASEERR + 1020; -pub const WSA_QOS_EFILTERCOUNT: c_int = WSABASEERR + 1021; -pub const WSA_QOS_EOBJLENGTH: c_int = WSABASEERR + 1022; -pub const WSA_QOS_EFLOWCOUNT: c_int = WSABASEERR + 1023; -pub const WSA_QOS_EUNKNOWNPSOBJ: c_int = WSABASEERR + 1024; -pub const WSA_QOS_EUNKOWNPSOBJ: c_int = WSA_QOS_EUNKNOWNPSOBJ; -pub const WSA_QOS_EPOLICYOBJ: c_int = WSABASEERR + 1025; -pub const WSA_QOS_EFLOWDESC: c_int = WSABASEERR + 1026; -pub const WSA_QOS_EPSFLOWSPEC: c_int = WSABASEERR + 1027; -pub const WSA_QOS_EPSFILTERSPEC: c_int = WSABASEERR + 1028; -pub const WSA_QOS_ESDMODEOBJ: c_int = WSABASEERR + 1029; -pub const WSA_QOS_ESHAPERATEOBJ: c_int = WSABASEERR + 1030; -pub const WSA_QOS_RESERVED_PETYPE: c_int = WSABASEERR + 1031; diff --git a/library/std/src/sys/windows/c/windows_sys.lst b/library/std/src/sys/windows/c/windows_sys.lst new file mode 100644 index 000000000000..2953f8f2eaee --- /dev/null +++ b/library/std/src/sys/windows/c/windows_sys.lst @@ -0,0 +1,2587 @@ +Windows.Wdk.Storage.FileSystem.NTCREATEFILE_CREATE_DISPOSITION +Windows.Wdk.Storage.FileSystem.NTCREATEFILE_CREATE_OPTIONS +Windows.Wdk.Storage.FileSystem.NtCreateFile +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.DUPLICATE_HANDLE_OPTIONS +Windows.Win32.Foundation.DuplicateHandle +Windows.Win32.Foundation.EXCEPTION_STACK_OVERFLOW +Windows.Win32.Foundation.E_NOTIMPL +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.GetLastError +Windows.Win32.Foundation.HANDLE +Windows.Win32.Foundation.HANDLE_FLAGS +Windows.Win32.Foundation.HMODULE +Windows.Win32.Foundation.INVALID_HANDLE_VALUE +Windows.Win32.Foundation.MAX_PATH +Windows.Win32.Foundation.NTSTATUS +Windows.Win32.Foundation.RtlNtStatusToDosError +Windows.Win32.Foundation.STATUS_DELETE_PENDING +Windows.Win32.Foundation.STATUS_END_OF_FILE +Windows.Win32.Foundation.STATUS_INVALID_PARAMETER +Windows.Win32.Foundation.STATUS_PENDING +Windows.Win32.Foundation.STATUS_SUCCESS +Windows.Win32.Foundation.SetHandleInformation +Windows.Win32.Foundation.SetLastError +Windows.Win32.Foundation.TRUE +Windows.Win32.Foundation.UNICODE_STRING +Windows.Win32.Foundation.WIN32_ERROR +Windows.Win32.Globalization.COMPARESTRING_RESULT +Windows.Win32.Globalization.CP_UTF8 +Windows.Win32.Globalization.CompareStringOrdinal +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.ADDRESS_FAMILY +Windows.Win32.Networking.WinSock.ADDRINFOA +Windows.Win32.Networking.WinSock.FD_SET +Windows.Win32.Networking.WinSock.FIONBIO +Windows.Win32.Networking.WinSock.IN6_ADDR +Windows.Win32.Networking.WinSock.INVALID_SOCKET +Windows.Win32.Networking.WinSock.IN_ADDR +Windows.Win32.Networking.WinSock.IPPROTO +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.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.LINGER +Windows.Win32.Networking.WinSock.LPWSAOVERLAPPED_COMPLETION_ROUTINE +Windows.Win32.Networking.WinSock.SEND_RECV_FLAGS +Windows.Win32.Networking.WinSock.SOCKADDR +Windows.Win32.Networking.WinSock.SOCKET +Windows.Win32.Networking.WinSock.SOCKET_ERROR +Windows.Win32.Networking.WinSock.SOL_SOCKET +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.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.WSABUF +Windows.Win32.Networking.WinSock.WSACleanup +Windows.Win32.Networking.WinSock.WSADATA +Windows.Win32.Networking.WinSock.WSADATA +Windows.Win32.Networking.WinSock.WSADuplicateSocketW +Windows.Win32.Networking.WinSock.WSAGetLastError +Windows.Win32.Networking.WinSock.WSAPROTOCOLCHAIN +Windows.Win32.Networking.WinSock.WSAPROTOCOL_INFOW +Windows.Win32.Networking.WinSock.WSARecv +Windows.Win32.Networking.WinSock.WSASend +Windows.Win32.Networking.WinSock.WSASocketW +Windows.Win32.Networking.WinSock.WSAStartup +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.accept +Windows.Win32.Networking.WinSock.bind +Windows.Win32.Networking.WinSock.closesocket +Windows.Win32.Networking.WinSock.connect +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.ioctlsocket +Windows.Win32.Networking.WinSock.listen +Windows.Win32.Networking.WinSock.recv +Windows.Win32.Networking.WinSock.recvfrom +Windows.Win32.Networking.WinSock.select +Windows.Win32.Networking.WinSock.send +Windows.Win32.Networking.WinSock.sendto +Windows.Win32.Networking.WinSock.setsockopt +Windows.Win32.Networking.WinSock.shutdown +Windows.Win32.Security.SECURITY_ATTRIBUTES +Windows.Win32.Security.TOKEN_ACCESS_MASK +Windows.Win32.Security.Authentication.Identity.RtlGenRandom +Windows.Win32.Security.Cryptography.BCRYPTGENRANDOM_FLAGS +Windows.Win32.Security.Cryptography.BCRYPT_ALG_HANDLE +Windows.Win32.Security.Cryptography.BCryptGenRandom +Windows.Win32.Storage.FileSystem.BY_HANDLE_FILE_INFORMATION +Windows.Win32.Storage.FileSystem.CopyFileExW +Windows.Win32.Storage.FileSystem.CreateDirectoryW +Windows.Win32.Storage.FileSystem.CreateFileW +Windows.Win32.Storage.FileSystem.CreateHardLinkW +Windows.Win32.Storage.FileSystem.CreateSymbolicLinkW +Windows.Win32.Storage.FileSystem.DeleteFileW +Windows.Win32.Storage.FileSystem.FILE_ACCESS_RIGHTS +Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_TAG_INFO +Windows.Win32.Storage.FileSystem.FILE_BASIC_INFO +Windows.Win32.Storage.FileSystem.FILE_CREATION_DISPOSITION +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_OF_FILE_INFO +Windows.Win32.Storage.FileSystem.FILE_FLAGS_AND_ATTRIBUTES +Windows.Win32.Storage.FileSystem.FILE_ID_BOTH_DIR_INFO +Windows.Win32.Storage.FileSystem.FILE_INFO_BY_HANDLE_CLASS +Windows.Win32.Storage.FileSystem.FILE_SHARE_MODE +Windows.Win32.Storage.FileSystem.FILE_STANDARD_INFO +Windows.Win32.Storage.FileSystem.FILE_TYPE +Windows.Win32.Storage.FileSystem.FindClose +Windows.Win32.Storage.FileSystem.FindFileHandle +Windows.Win32.Storage.FileSystem.FindFirstFileW +Windows.Win32.Storage.FileSystem.FindNextFileW +Windows.Win32.Storage.FileSystem.FlushFileBuffers +Windows.Win32.Storage.FileSystem.GETFINALPATHNAMEBYHANDLE_FLAGS +Windows.Win32.Storage.FileSystem.GetFileAttributesW +Windows.Win32.Storage.FileSystem.GetFileInformationByHandle +Windows.Win32.Storage.FileSystem.GetFileInformationByHandleEx +Windows.Win32.Storage.FileSystem.GetFileType +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.LPPROGRESS_ROUTINE +Windows.Win32.Storage.FileSystem.LPPROGRESS_ROUTINE_CALLBACK_REASON +Windows.Win32.Storage.FileSystem.MAXIMUM_REPARSE_DATA_BUFFER_SIZE +Windows.Win32.Storage.FileSystem.MOVE_FILE_FLAGS +Windows.Win32.Storage.FileSystem.MoveFileExW +Windows.Win32.Storage.FileSystem.ReadFile +Windows.Win32.Storage.FileSystem.ReadFileEx +Windows.Win32.Storage.FileSystem.RemoveDirectoryW +Windows.Win32.Storage.FileSystem.SET_FILE_POINTER_MOVE_METHOD +Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAGS +Windows.Win32.Storage.FileSystem.SetFileAttributesW +Windows.Win32.Storage.FileSystem.SetFileInformationByHandle +Windows.Win32.Storage.FileSystem.SetFilePointerEx +Windows.Win32.Storage.FileSystem.SetFileTime +Windows.Win32.Storage.FileSystem.WIN32_FIND_DATAW +Windows.Win32.Storage.FileSystem.WriteFileEx +Windows.Win32.System.Console.CONSOLE_MODE +Windows.Win32.System.Console.CONSOLE_READCONSOLE_CONTROL +Windows.Win32.System.Console.GetConsoleMode +Windows.Win32.System.Console.GetStdHandle +Windows.Win32.System.Console.ReadConsoleW +Windows.Win32.System.Console.STD_HANDLE +Windows.Win32.System.Console.WriteConsoleW +Windows.Win32.System.Diagnostics.Debug.ARM64_NT_NEON128 +Windows.Win32.System.Diagnostics.Debug.AddVectoredExceptionHandler +Windows.Win32.System.Diagnostics.Debug.CONTEXT +Windows.Win32.System.Diagnostics.Debug.CONTEXT +Windows.Win32.System.Diagnostics.Debug.CONTEXT +Windows.Win32.System.Diagnostics.Debug.EXCEPTION_POINTERS +Windows.Win32.System.Diagnostics.Debug.EXCEPTION_RECORD +Windows.Win32.System.Diagnostics.Debug.FACILITY_CODE +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.PVECTORED_EXCEPTION_HANDLER +Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT +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.FLOATING_SAVE_AREA +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.NAMED_PIPE_MODE +Windows.Win32.System.SystemInformation.GetSystemDirectoryW +Windows.Win32.System.SystemInformation.GetSystemInfo +Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime +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.IO_REPARSE_TAG_MOUNT_POINT +Windows.Win32.System.SystemServices.IO_REPARSE_TAG_SYMLINK +Windows.Win32.System.Threading.AcquireSRWLockExclusive +Windows.Win32.System.Threading.AcquireSRWLockShared +Windows.Win32.System.Threading.CreateEventW +Windows.Win32.System.Threading.CreateProcessW +Windows.Win32.System.Threading.CreateThread +Windows.Win32.System.Threading.ExitProcess +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.INFINITE +Windows.Win32.System.Threading.INIT_ONCE_INIT_FAILED +Windows.Win32.System.Threading.InitOnceBeginInitialize +Windows.Win32.System.Threading.InitOnceComplete +Windows.Win32.System.Threading.LPTHREAD_START_ROUTINE +Windows.Win32.System.Threading.OpenProcessToken +Windows.Win32.System.Threading.PROCESS_CREATION_FLAGS +Windows.Win32.System.Threading.PROCESS_INFORMATION +Windows.Win32.System.Threading.RTL_CONDITION_VARIABLE +Windows.Win32.System.Threading.RTL_RUN_ONCE +Windows.Win32.System.Threading.RTL_SRWLOCK +Windows.Win32.System.Threading.ReleaseSRWLockExclusive +Windows.Win32.System.Threading.ReleaseSRWLockShared +Windows.Win32.System.Threading.STARTUPINFOW +Windows.Win32.System.Threading.STARTUPINFOW_FLAGS +Windows.Win32.System.Threading.SetThreadStackGuarantee +Windows.Win32.System.Threading.Sleep +Windows.Win32.System.Threading.SleepConditionVariableSRW +Windows.Win32.System.Threading.SleepEx +Windows.Win32.System.Threading.SwitchToThread +Windows.Win32.System.Threading.THREAD_CREATION_FLAGS +Windows.Win32.System.Threading.TLS_OUT_OF_INDEXES +Windows.Win32.System.Threading.TerminateProcess +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.WaitForMultipleObjects +Windows.Win32.System.Threading.WaitForSingleObject +Windows.Win32.System.Threading.WakeAllConditionVariable +Windows.Win32.System.Threading.WakeConditionVariable +Windows.Win32.System.WindowsProgramming.IO_STATUS_BLOCK +Windows.Win32.System.WindowsProgramming.OBJECT_ATTRIBUTES +Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE +Windows.Win32.UI.Shell.GetUserProfileDirectoryW +Windows.Wdk.Storage.FileSystem.FILE_CREATE +Windows.Wdk.Storage.FileSystem.FILE_OPEN +Windows.Wdk.Storage.FileSystem.FILE_OPEN_IF +Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE +Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE_IF +Windows.Wdk.Storage.FileSystem.FILE_SUPERSEDE +Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED +Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION +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 +Windows.Wdk.Storage.FileSystem.FILE_NON_DIRECTORY_FILE +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_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_NO_RECALL +Windows.Wdk.Storage.FileSystem.FILE_OPEN_REPARSE_POINT +Windows.Wdk.Storage.FileSystem.FILE_OPEN_REQUIRING_OPLOCK +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_SYNCHRONOUS_IO_ALERT +Windows.Wdk.Storage.FileSystem.FILE_SYNCHRONOUS_IO_NONALERT +Windows.Wdk.Storage.FileSystem.FILE_WRITE_THROUGH +Windows.Win32.Foundation.DUPLICATE_CLOSE_SOURCE +Windows.Win32.Foundation.DUPLICATE_SAME_ACCESS +Windows.Win32.Foundation.GENERIC_ALL +Windows.Win32.Foundation.GENERIC_EXECUTE +Windows.Win32.Foundation.GENERIC_READ +Windows.Win32.Foundation.GENERIC_WRITE +Windows.Win32.Foundation.HANDLE_FLAG_INHERIT +Windows.Win32.Foundation.HANDLE_FLAG_PROTECT_FROM_CLOSE +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_ZONESCOPE_NAME +Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONE_OPERATION +Windows.Win32.Foundation.DNS_ERROR_INVALID_ZONE_TYPE +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_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_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_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_NOTAUTH +Windows.Win32.Foundation.DNS_ERROR_RCODE_NOTZONE +Windows.Win32.Foundation.DNS_ERROR_RCODE_NOT_IMPLEMENTED +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_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.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.ERROR_ABANDONED_WAIT_0 +Windows.Win32.Foundation.ERROR_ABANDONED_WAIT_63 +Windows.Win32.Foundation.ERROR_ABANDON_HIBERFILE +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_ALLOCATE_BUCKET +Windows.Win32.Foundation.ERROR_ALLOTTED_SPACE_EXCEEDED +Windows.Win32.Foundation.ERROR_ALL_USER_TRUST_QUOTA_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_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_APP_HANG +Windows.Win32.Foundation.ERROR_APP_INIT_FAILURE +Windows.Win32.Foundation.ERROR_APP_WRONG_OS +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_BADDB +Windows.Win32.Foundation.ERROR_BADKEY +Windows.Win32.Foundation.ERROR_BADSTARTPOSITION +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_DEVICE +Windows.Win32.Foundation.ERROR_BAD_DEVICE_PATH +Windows.Win32.Foundation.ERROR_BAD_DEV_TYPE +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_NETPATH +Windows.Win32.Foundation.ERROR_BAD_NET_NAME +Windows.Win32.Foundation.ERROR_BAD_NET_RESP +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_USERNAME +Windows.Win32.Foundation.ERROR_BAD_USER_PROFILE +Windows.Win32.Foundation.ERROR_BAD_VALIDATION_CLASS +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_BLOCKED_BY_PARENTAL_CONTROLS +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_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_BUSY +Windows.Win32.Foundation.ERROR_BUSY_DRIVE +Windows.Win32.Foundation.ERROR_BUS_RESET +Windows.Win32.Foundation.ERROR_BYPASSIO_FLT_NOT_SUPPORTED +Windows.Win32.Foundation.ERROR_CACHE_PAGE_LOCKED +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_CALL_NOT_IMPLEMENTED +Windows.Win32.Foundation.ERROR_CANCELLED +Windows.Win32.Foundation.ERROR_CANCEL_VIOLATION +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_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_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_CAN_NOT_COMPLETE +Windows.Win32.Foundation.ERROR_CAPAUTHZ_CHANGE_TYPE +Windows.Win32.Foundation.ERROR_CAPAUTHZ_DB_CORRUPTED +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_NO_POLICY +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_INCOMPATIBLE_HARDLINKS +Windows.Win32.Foundation.ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES +Windows.Win32.Foundation.ERROR_CLOUD_FILE_INVALID_REQUEST +Windows.Win32.Foundation.ERROR_CLOUD_FILE_IN_USE +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_CSCSHARE_OFFLINE +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_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_DATABASE_DOES_NOT_EXIST +Windows.Win32.Foundation.ERROR_DATATYPE_MISMATCH +Windows.Win32.Foundation.ERROR_DATA_CHECKSUM_ERROR +Windows.Win32.Foundation.ERROR_DATA_NOT_ACCEPTED +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_DEBUGGER_INACTIVE +Windows.Win32.Foundation.ERROR_DEBUG_ATTACH_FAILED +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_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_NOT_CONNECTED +Windows.Win32.Foundation.ERROR_DEVICE_NOT_PARTITIONED +Windows.Win32.Foundation.ERROR_DEVICE_NO_RESOURCES +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_DEV_NOT_EXIST +Windows.Win32.Foundation.ERROR_DHCP_ADDRESS_CONFLICT +Windows.Win32.Foundation.ERROR_DIFFERENT_SERVICE_ACCOUNT +Windows.Win32.Foundation.ERROR_DIRECTORY +Windows.Win32.Foundation.ERROR_DIRECTORY_NOT_SUPPORTED +Windows.Win32.Foundation.ERROR_DIRECT_ACCESS_HANDLE +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_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_DRIVERS_LEAKING_LOCKED_PAGES +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_DRIVE_LOCKED +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_ALIASED_OBJ_MISSING +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_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_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_AUDIT_FAILURE +Windows.Win32.Foundation.ERROR_DS_AUTHORIZATION_FAILED +Windows.Win32.Foundation.ERROR_DS_AUTH_METHOD_NOT_SUPPORTED +Windows.Win32.Foundation.ERROR_DS_AUTH_UNKNOWN +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_DELETE +Windows.Win32.Foundation.ERROR_DS_CANT_DELETE_DSA_OBJ +Windows.Win32.Foundation.ERROR_DS_CANT_DEL_MASTER_CROSSREF +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_REMOVE_ATT_CACHE +Windows.Win32.Foundation.ERROR_DS_CANT_REMOVE_CLASS_CACHE +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_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_CROSS_DOMAIN_CLEANUP_REQD +Windows.Win32.Foundation.ERROR_DS_CROSS_DOM_MOVE_ERROR +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_CR_IMPOSSIBLE_TO_VALIDATE +Windows.Win32.Foundation.ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 +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_NOT_SUPPORTED +Windows.Win32.Foundation.ERROR_DS_DRA_NO_REPLICA +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_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_DS_REQUIRED +Windows.Win32.Foundation.ERROR_DS_DUPLICATE_ID_FOUND +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_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_GCVERIFY_ERROR +Windows.Win32.Foundation.ERROR_DS_GC_NOT_AVAILABLE +Windows.Win32.Foundation.ERROR_DS_GC_REQUIRED +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_INSUFFICIENT_ATTR_TO_CREATE_OBJECT +Windows.Win32.Foundation.ERROR_DS_INSUFF_ACCESS_RIGHTS +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_NOT_FOUND +Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NOT_UNIQUE +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_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_NCNAME_MISSING_CR_REF +Windows.Win32.Foundation.ERROR_DS_NCNAME_MUST_BE_NC +Windows.Win32.Foundation.ERROR_DS_NC_MUST_HAVE_NC_PARENT +Windows.Win32.Foundation.ERROR_DS_NC_STILL_HAS_DSAS +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_NON_ASQ_SEARCH +Windows.Win32.Foundation.ERROR_DS_NON_BASE_SEARCH +Windows.Win32.Foundation.ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX +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_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_NTDSCRIPT_PROCESS_ERROR +Windows.Win32.Foundation.ERROR_DS_NTDSCRIPT_SYNTAX_ERROR +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_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_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_REPLICATOR_ONLY +Windows.Win32.Foundation.ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR +Windows.Win32.Foundation.ERROR_DS_REPL_LIFETIME_EXCEEDED +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_SECURITY_CHECKING_ERROR +Windows.Win32.Foundation.ERROR_DS_SECURITY_ILLEGAL_MODIFY +Windows.Win32.Foundation.ERROR_DS_SEC_DESC_INVALID +Windows.Win32.Foundation.ERROR_DS_SEC_DESC_TOO_SHORT +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_SUBREF_MUST_HAVE_PARENT +Windows.Win32.Foundation.ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD +Windows.Win32.Foundation.ERROR_DS_SUB_CLS_TEST_FAIL +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_DUPLICATE_PRIVILEGES +Windows.Win32.Foundation.ERROR_DUPLICATE_SERVICE_NAME +Windows.Win32.Foundation.ERROR_DUP_DOMAINNAME +Windows.Win32.Foundation.ERROR_DUP_NAME +Windows.Win32.Foundation.ERROR_DYNAMIC_CODE_BLOCKED +Windows.Win32.Foundation.ERROR_DYNLINK_FROM_INVALID_RING +Windows.Win32.Foundation.ERROR_EAS_DIDNT_FIT +Windows.Win32.Foundation.ERROR_EAS_NOT_SUPPORTED +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_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_EVENTLOG_CANT_START +Windows.Win32.Foundation.ERROR_EVENTLOG_FILE_CHANGED +Windows.Win32.Foundation.ERROR_EVENTLOG_FILE_CORRUPT +Windows.Win32.Foundation.ERROR_EVENT_DONE +Windows.Win32.Foundation.ERROR_EVENT_PENDING +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_FAILED_DRIVER_ENTRY +Windows.Win32.Foundation.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT +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_FATAL_APP_EXIT +Windows.Win32.Foundation.ERROR_FILEMARK_DETECTED +Windows.Win32.Foundation.ERROR_FILENAME_EXCED_RANGE +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_INVALID_PARAMETER +Windows.Win32.Foundation.ERROR_FILE_SNAP_IN_PROGRESS +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_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_FSFILTER_OP_COMPLETED_SUCCESSFULLY +Windows.Win32.Foundation.ERROR_FS_DRIVER_REQUIRED +Windows.Win32.Foundation.ERROR_FS_METADATA_INCONSISTENT +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_GENERIC_NOT_MAPPED +Windows.Win32.Foundation.ERROR_GEN_FAILURE +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_HANDLES_CLOSED +Windows.Win32.Foundation.ERROR_HANDLE_DISK_FULL +Windows.Win32.Foundation.ERROR_HANDLE_EOF +Windows.Win32.Foundation.ERROR_HANDLE_REVOKED +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_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_ILL_FORMED_PASSWORD +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_DOMAINNAME +Windows.Win32.Foundation.ERROR_INVALID_DOMAIN_ROLE +Windows.Win32.Foundation.ERROR_INVALID_DOMAIN_STATE +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_EVENTNAME +Windows.Win32.Foundation.ERROR_INVALID_EVENT_COUNT +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_FLAGS +Windows.Win32.Foundation.ERROR_INVALID_FLAG_NUMBER +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_GROUPNAME +Windows.Win32.Foundation.ERROR_INVALID_GROUP_ATTRIBUTES +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_SERVICENAME +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_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_IOPL_NOT_ENABLED +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_IPSEC_IKE_TIMED_OUT +Windows.Win32.Foundation.ERROR_IP_ADDRESS_CONFLICT1 +Windows.Win32.Foundation.ERROR_IP_ADDRESS_CONFLICT2 +Windows.Win32.Foundation.ERROR_IRQ_BUSY +Windows.Win32.Foundation.ERROR_IS_JOINED +Windows.Win32.Foundation.ERROR_IS_JOIN_PATH +Windows.Win32.Foundation.ERROR_IS_JOIN_TARGET +Windows.Win32.Foundation.ERROR_IS_SUBSTED +Windows.Win32.Foundation.ERROR_IS_SUBST_PATH +Windows.Win32.Foundation.ERROR_IS_SUBST_TARGET +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_LOCKED +Windows.Win32.Foundation.ERROR_LOCK_FAILED +Windows.Win32.Foundation.ERROR_LOCK_VIOLATION +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_LOG_FILE_FULL +Windows.Win32.Foundation.ERROR_LOG_HARD_ERROR +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_MEMBERS_PRIMARY_GROUP +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_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_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_NET_OPEN_FAILED +Windows.Win32.Foundation.ERROR_NET_WRITE_FAULT +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_NONE_MAPPED +Windows.Win32.Foundation.ERROR_NONPAGED_SYSTEM_RESOURCES +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_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_NOT_ALLOWED_ON_SYSTEM_FILE +Windows.Win32.Foundation.ERROR_NOT_ALL_ASSIGNED +Windows.Win32.Foundation.ERROR_NOT_APPCONTAINER +Windows.Win32.Foundation.ERROR_NOT_AUTHENTICATED +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_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_READY +Windows.Win32.Foundation.ERROR_NOT_READ_FROM_COPY +Windows.Win32.Foundation.ERROR_NOT_REDUNDANT_STORAGE +Windows.Win32.Foundation.ERROR_NOT_REGISTRY_FILE +Windows.Win32.Foundation.ERROR_NOT_SAFEBOOT_SERVICE +Windows.Win32.Foundation.ERROR_NOT_SAFE_MODE_DRIVER +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_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_LOGON_SERVERS +Windows.Win32.Foundation.ERROR_NO_LOG_SPACE +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_NETWORK +Windows.Win32.Foundation.ERROR_NO_NET_OR_BAD_PATH +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_SITENAME +Windows.Win32.Foundation.ERROR_NO_SITE_SETTINGS_OBJECT +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_NTLM_BLOCKED +Windows.Win32.Foundation.ERROR_NT_CROSS_ENCRYPTION_REQUIRED +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_OUTOFMEMORY +Windows.Win32.Foundation.ERROR_OUT_OF_PAPER +Windows.Win32.Foundation.ERROR_OUT_OF_STRUCTURES +Windows.Win32.Foundation.ERROR_OVERRIDE_NOCHANGES +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_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_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_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_PRINT_CANCELLED +Windows.Win32.Foundation.ERROR_PRIVATE_DIALOG_INDEX +Windows.Win32.Foundation.ERROR_PRIVILEGE_NOT_HELD +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_PROC_NOT_FOUND +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_REDIRECTOR_HAS_OPEN_HANDLES +Windows.Win32.Foundation.ERROR_REDIR_PAUSED +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_REG_NAT_CONSUMPTION +Windows.Win32.Foundation.ERROR_RELOC_CHAIN_XEEDS_SEGLIM +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_REM_NOT_LIST +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_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_REQ_NOT_ACCEP +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_RING2SEG_MUST_BE_MOVABLE +Windows.Win32.Foundation.ERROR_RING2_STACK_IN_USE +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_COMMITTED +Windows.Win32.Foundation.ERROR_RXACT_COMMIT_FAILURE +Windows.Win32.Foundation.ERROR_RXACT_COMMIT_NECESSARY +Windows.Win32.Foundation.ERROR_RXACT_INVALID_STATE +Windows.Win32.Foundation.ERROR_RXACT_STATE_CREATED +Windows.Win32.Foundation.ERROR_SAME_DRIVE +Windows.Win32.Foundation.ERROR_SAM_INIT_FAILURE +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_NOTIFICATION +Windows.Win32.Foundation.ERROR_SERVICE_NOTIFY_CLIENT_LAGGING +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_NO_THREAD +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_SETCOUNT_ON_BAD_LB +Windows.Win32.Foundation.ERROR_SETMARK_DETECTED +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_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_SYNCHRONIZATION_REQUIRED +Windows.Win32.Foundation.ERROR_SYNC_FOREGROUND_REFRESH_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_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_TIME_SENSITIVE_THREAD +Windows.Win32.Foundation.ERROR_TIME_SKEW +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_SEMAPHORES +Windows.Win32.Foundation.ERROR_TOO_MANY_SEM_REQUESTS +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_TRUSTED_DOMAIN_FAILURE +Windows.Win32.Foundation.ERROR_TRUSTED_RELATIONSHIP_FAILURE +Windows.Win32.Foundation.ERROR_TRUST_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_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_UNEXP_NET_ERR +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_SUPPORTED +Windows.Win32.Foundation.ERROR_VOLUME_NOT_SUPPORT_EFS +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_XMLDSIG_ERROR +Windows.Win32.Foundation.ERROR_XML_PARSE_ERROR +Windows.Win32.Foundation.NO_ERROR +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.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.Networking.WinSock.AF_INET +Windows.Win32.Networking.WinSock.AF_INET6 +Windows.Win32.Networking.WinSock.AF_UNSPEC +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.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.SD_BOTH +Windows.Win32.Networking.WinSock.SD_RECEIVE +Windows.Win32.Networking.WinSock.SD_SEND +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.WSABASEERR +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.WSAHOST_NOT_FOUND +Windows.Win32.Networking.WinSock.WSANOTINITIALISED +Windows.Win32.Networking.WinSock.WSANO_DATA +Windows.Win32.Networking.WinSock.WSANO_RECOVERY +Windows.Win32.Networking.WinSock.WSASERVICE_NOT_FOUND +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.Networking.WinSock.WSA_E_CANCELLED +Windows.Win32.Networking.WinSock.WSA_E_NO_MORE +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.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.Security.Cryptography.BCRYPT_USE_SYSTEM_PREFERRED_RNG +Windows.Win32.Storage.FileSystem.DELETE +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_APPEND_DATA +Windows.Win32.Storage.FileSystem.FILE_CREATE_PIPE_INSTANCE +Windows.Win32.Storage.FileSystem.FILE_DELETE_CHILD +Windows.Win32.Storage.FileSystem.FILE_EXECUTE +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_LIST_DIRECTORY +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_TRAVERSE +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.READ_CONTROL +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.SYNCHRONIZE +Windows.Win32.Storage.FileSystem.WRITE_DAC +Windows.Win32.Storage.FileSystem.WRITE_OWNER +Windows.Win32.Storage.FileSystem.CREATE_ALWAYS +Windows.Win32.Storage.FileSystem.CREATE_NEW +Windows.Win32.Storage.FileSystem.OPEN_ALWAYS +Windows.Win32.Storage.FileSystem.OPEN_EXISTING +Windows.Win32.Storage.FileSystem.TRUNCATE_EXISTING +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_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_NORMAL +Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED +Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_NO_SCRUB_DATA +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_TEMPORARY +Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_UNPINNED +Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_VIRTUAL +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.PIPE_ACCESS_DUPLEX +Windows.Win32.Storage.FileSystem.PIPE_ACCESS_INBOUND +Windows.Win32.Storage.FileSystem.PIPE_ACCESS_OUTBOUND +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.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.MaximumFileInfoByHandleClass +Windows.Win32.Storage.FileSystem.FILE_SHARE_DELETE +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_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_NAME_NORMALIZED +Windows.Win32.Storage.FileSystem.FILE_NAME_OPENED +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.CALLBACK_CHUNK_FINISHED +Windows.Win32.Storage.FileSystem.CALLBACK_STREAM_SWITCH +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.FILE_BEGIN +Windows.Win32.Storage.FileSystem.FILE_CURRENT +Windows.Win32.Storage.FileSystem.FILE_END +Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE +Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAG_DIRECTORY +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.STD_ERROR_HANDLE +Windows.Win32.System.Console.STD_INPUT_HANDLE +Windows.Win32.System.Console.STD_OUTPUT_HANDLE +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.Kernel.ExceptionCollidedUnwind +Windows.Win32.System.Kernel.ExceptionContinueExecution +Windows.Win32.System.Kernel.ExceptionContinueSearch +Windows.Win32.System.Kernel.ExceptionNestedException +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.Threading.ABOVE_NORMAL_PRIORITY_CLASS +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.DEBUG_ONLY_THIS_PROCESS +Windows.Win32.System.Threading.DEBUG_PROCESS +Windows.Win32.System.Threading.DETACHED_PROCESS +Windows.Win32.System.Threading.EXTENDED_STARTUPINFO_PRESENT +Windows.Win32.System.Threading.HIGH_PRIORITY_CLASS +Windows.Win32.System.Threading.IDLE_PRIORITY_CLASS +Windows.Win32.System.Threading.INHERIT_CALLER_PRIORITY +Windows.Win32.System.Threading.INHERIT_PARENT_AFFINITY +Windows.Win32.System.Threading.NORMAL_PRIORITY_CLASS +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.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.STACK_SIZE_PARAM_IS_A_RESERVATION +Windows.Win32.System.Threading.THREAD_CREATE_RUN_IMMEDIATELY +Windows.Win32.System.Threading.THREAD_CREATE_SUSPENDED diff --git a/library/std/src/sys/windows/c/windows_sys.rs b/library/std/src/sys/windows/c/windows_sys.rs new file mode 100644 index 000000000000..36a30f6ba565 --- /dev/null +++ b/library/std/src/sys/windows/c/windows_sys.rs @@ -0,0 +1,4276 @@ +// This file is autogenerated. +// +// To add bindings, edit windows_sys.lst then use `./x run generate-windows-sys` to +// regenerate the bindings. +// +// ignore-tidy-filelength +// Bindings generated by `windows-bindgen` 0.49.0 + +#![allow(non_snake_case, non_upper_case_globals, non_camel_case_types, dead_code, clippy::all)] +#[link(name = "advapi32")] +extern "system" { + pub fn OpenProcessToken( + processhandle: HANDLE, + desiredaccess: TOKEN_ACCESS_MASK, + tokenhandle: *mut HANDLE, + ) -> BOOL; +} +#[link(name = "advapi32")] +extern "system" { + #[link_name = "SystemFunction036"] + pub fn RtlGenRandom(randombuffer: *mut ::core::ffi::c_void, randombufferlength: u32) + -> BOOLEAN; +} +#[link(name = "bcrypt")] +extern "system" { + pub fn BCryptGenRandom( + halgorithm: BCRYPT_ALG_HANDLE, + pbbuffer: *mut u8, + cbbuffer: u32, + dwflags: BCRYPTGENRANDOM_FLAGS, + ) -> NTSTATUS; +} +#[link(name = "kernel32")] +extern "system" { + pub fn AcquireSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn AcquireSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn AddVectoredExceptionHandler( + first: u32, + handler: PVECTORED_EXCEPTION_HANDLER, + ) -> *mut ::core::ffi::c_void; +} +#[link(name = "kernel32")] +extern "system" { + pub fn CancelIo(hfile: HANDLE) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn CloseHandle(hobject: HANDLE) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn CompareStringOrdinal( + lpstring1: PCWSTR, + cchcount1: i32, + lpstring2: PCWSTR, + cchcount2: i32, + bignorecase: BOOL, + ) -> COMPARESTRING_RESULT; +} +#[link(name = "kernel32")] +extern "system" { + pub fn CopyFileExW( + lpexistingfilename: PCWSTR, + lpnewfilename: PCWSTR, + lpprogressroutine: LPPROGRESS_ROUTINE, + lpdata: *const ::core::ffi::c_void, + pbcancel: *mut i32, + dwcopyflags: u32, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn CreateDirectoryW( + lppathname: PCWSTR, + lpsecurityattributes: *const SECURITY_ATTRIBUTES, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn CreateEventW( + lpeventattributes: *const SECURITY_ATTRIBUTES, + bmanualreset: BOOL, + binitialstate: BOOL, + lpname: PCWSTR, + ) -> HANDLE; +} +#[link(name = "kernel32")] +extern "system" { + pub 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; +} +#[link(name = "kernel32")] +extern "system" { + pub fn CreateHardLinkW( + lpfilename: PCWSTR, + lpexistingfilename: PCWSTR, + lpsecurityattributes: *const SECURITY_ATTRIBUTES, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub 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; +} +#[link(name = "kernel32")] +extern "system" { + pub 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; +} +#[link(name = "kernel32")] +extern "system" { + pub fn CreateSymbolicLinkW( + lpsymlinkfilename: PCWSTR, + lptargetfilename: PCWSTR, + dwflags: SYMBOLIC_LINK_FLAGS, + ) -> BOOLEAN; +} +#[link(name = "kernel32")] +extern "system" { + pub 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; +} +#[link(name = "kernel32")] +extern "system" { + pub fn DeleteFileW(lpfilename: PCWSTR) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn DeviceIoControl( + hdevice: HANDLE, + dwiocontrolcode: u32, + lpinbuffer: *const ::core::ffi::c_void, + ninbuffersize: u32, + lpoutbuffer: *mut ::core::ffi::c_void, + noutbuffersize: u32, + lpbytesreturned: *mut u32, + lpoverlapped: *mut OVERLAPPED, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn DuplicateHandle( + hsourceprocesshandle: HANDLE, + hsourcehandle: HANDLE, + htargetprocesshandle: HANDLE, + lptargethandle: *mut HANDLE, + dwdesiredaccess: u32, + binherithandle: BOOL, + dwoptions: DUPLICATE_HANDLE_OPTIONS, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn ExitProcess(uexitcode: u32) -> !; +} +#[link(name = "kernel32")] +extern "system" { + pub fn FindClose(hfindfile: FindFileHandle) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn FindFirstFileW( + lpfilename: PCWSTR, + lpfindfiledata: *mut WIN32_FIND_DATAW, + ) -> FindFileHandle; +} +#[link(name = "kernel32")] +extern "system" { + pub fn FindNextFileW(hfindfile: FindFileHandle, lpfindfiledata: *mut WIN32_FIND_DATAW) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn FlushFileBuffers(hfile: HANDLE) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn FormatMessageW( + dwflags: FORMAT_MESSAGE_OPTIONS, + lpsource: *const ::core::ffi::c_void, + dwmessageid: u32, + dwlanguageid: u32, + lpbuffer: PWSTR, + nsize: u32, + arguments: *const *const i8, + ) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn FreeEnvironmentStringsW(penv: PCWSTR) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetCommandLineW() -> PCWSTR; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetConsoleMode(hconsolehandle: HANDLE, lpmode: *mut CONSOLE_MODE) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetCurrentDirectoryW(nbufferlength: u32, lpbuffer: PWSTR) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetCurrentProcess() -> HANDLE; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetCurrentProcessId() -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetCurrentThread() -> HANDLE; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetEnvironmentStringsW() -> PWSTR; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetEnvironmentVariableW(lpname: PCWSTR, lpbuffer: PWSTR, nsize: u32) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetExitCodeProcess(hprocess: HANDLE, lpexitcode: *mut u32) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetFileAttributesW(lpfilename: PCWSTR) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetFileInformationByHandle( + hfile: HANDLE, + lpfileinformation: *mut BY_HANDLE_FILE_INFORMATION, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetFileInformationByHandleEx( + hfile: HANDLE, + fileinformationclass: FILE_INFO_BY_HANDLE_CLASS, + lpfileinformation: *mut ::core::ffi::c_void, + dwbuffersize: u32, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetFileType(hfile: HANDLE) -> FILE_TYPE; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetFinalPathNameByHandleW( + hfile: HANDLE, + lpszfilepath: PWSTR, + cchfilepath: u32, + dwflags: GETFINALPATHNAMEBYHANDLE_FLAGS, + ) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetFullPathNameW( + lpfilename: PCWSTR, + nbufferlength: u32, + lpbuffer: PWSTR, + lpfilepart: *mut PWSTR, + ) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetLastError() -> WIN32_ERROR; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetModuleFileNameW(hmodule: HMODULE, lpfilename: PWSTR, nsize: u32) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetModuleHandleA(lpmodulename: PCSTR) -> HMODULE; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetModuleHandleW(lpmodulename: PCWSTR) -> HMODULE; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetOverlappedResult( + hfile: HANDLE, + lpoverlapped: *const OVERLAPPED, + lpnumberofbytestransferred: *mut u32, + bwait: BOOL, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetProcAddress(hmodule: HMODULE, lpprocname: PCSTR) -> FARPROC; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetProcessId(process: HANDLE) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetStdHandle(nstdhandle: STD_HANDLE) -> HANDLE; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetSystemDirectoryW(lpbuffer: PWSTR, usize: u32) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetSystemInfo(lpsysteminfo: *mut SYSTEM_INFO) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetSystemTimeAsFileTime(lpsystemtimeasfiletime: *mut FILETIME) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetTempPathW(nbufferlength: u32, lpbuffer: PWSTR) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn GetWindowsDirectoryW(lpbuffer: PWSTR, usize: u32) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn InitOnceBeginInitialize( + lpinitonce: *mut RTL_RUN_ONCE, + dwflags: u32, + fpending: *mut BOOL, + lpcontext: *mut *mut ::core::ffi::c_void, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn InitOnceComplete( + lpinitonce: *mut RTL_RUN_ONCE, + dwflags: u32, + lpcontext: *const ::core::ffi::c_void, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn MoveFileExW( + lpexistingfilename: PCWSTR, + lpnewfilename: PCWSTR, + dwflags: MOVE_FILE_FLAGS, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn MultiByteToWideChar( + codepage: u32, + dwflags: MULTI_BYTE_TO_WIDE_CHAR_FLAGS, + lpmultibytestr: PCSTR, + cbmultibyte: i32, + lpwidecharstr: PWSTR, + cchwidechar: i32, + ) -> i32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn QueryPerformanceCounter(lpperformancecount: *mut i64) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn QueryPerformanceFrequency(lpfrequency: *mut i64) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn ReadConsoleW( + hconsoleinput: HANDLE, + lpbuffer: *mut ::core::ffi::c_void, + nnumberofcharstoread: u32, + lpnumberofcharsread: *mut u32, + pinputcontrol: *const CONSOLE_READCONSOLE_CONTROL, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn ReadFile( + hfile: HANDLE, + lpbuffer: *mut ::core::ffi::c_void, + nnumberofbytestoread: u32, + lpnumberofbytesread: *mut u32, + lpoverlapped: *mut OVERLAPPED, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn ReadFileEx( + hfile: HANDLE, + lpbuffer: *mut ::core::ffi::c_void, + nnumberofbytestoread: u32, + lpoverlapped: *mut OVERLAPPED, + lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn ReleaseSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn ReleaseSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn RemoveDirectoryW(lppathname: PCWSTR) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetCurrentDirectoryW(lppathname: PCWSTR) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetEnvironmentVariableW(lpname: PCWSTR, lpvalue: PCWSTR) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetFileAttributesW( + lpfilename: PCWSTR, + dwfileattributes: FILE_FLAGS_AND_ATTRIBUTES, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetFileInformationByHandle( + hfile: HANDLE, + fileinformationclass: FILE_INFO_BY_HANDLE_CLASS, + lpfileinformation: *const ::core::ffi::c_void, + dwbuffersize: u32, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetFilePointerEx( + hfile: HANDLE, + lidistancetomove: i64, + lpnewfilepointer: *mut i64, + dwmovemethod: SET_FILE_POINTER_MOVE_METHOD, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetFileTime( + hfile: HANDLE, + lpcreationtime: *const FILETIME, + lplastaccesstime: *const FILETIME, + lplastwritetime: *const FILETIME, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetHandleInformation(hobject: HANDLE, dwmask: u32, dwflags: HANDLE_FLAGS) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetLastError(dwerrcode: WIN32_ERROR) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn SetThreadStackGuarantee(stacksizeinbytes: *mut u32) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn Sleep(dwmilliseconds: u32) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn SleepConditionVariableSRW( + conditionvariable: *mut RTL_CONDITION_VARIABLE, + srwlock: *mut RTL_SRWLOCK, + dwmilliseconds: u32, + flags: u32, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SleepEx(dwmilliseconds: u32, balertable: BOOL) -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn SwitchToThread() -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn TerminateProcess(hprocess: HANDLE, uexitcode: u32) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn TlsAlloc() -> u32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn TlsFree(dwtlsindex: u32) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn TlsGetValue(dwtlsindex: u32) -> *mut ::core::ffi::c_void; +} +#[link(name = "kernel32")] +extern "system" { + pub fn TlsSetValue(dwtlsindex: u32, lptlsvalue: *const ::core::ffi::c_void) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn TryAcquireSRWLockExclusive(srwlock: *mut RTL_SRWLOCK) -> BOOLEAN; +} +#[link(name = "kernel32")] +extern "system" { + pub fn TryAcquireSRWLockShared(srwlock: *mut RTL_SRWLOCK) -> BOOLEAN; +} +#[link(name = "kernel32")] +extern "system" { + pub fn WaitForMultipleObjects( + ncount: u32, + lphandles: *const HANDLE, + bwaitall: BOOL, + dwmilliseconds: u32, + ) -> WIN32_ERROR; +} +#[link(name = "kernel32")] +extern "system" { + pub fn WaitForSingleObject(hhandle: HANDLE, dwmilliseconds: u32) -> WIN32_ERROR; +} +#[link(name = "kernel32")] +extern "system" { + pub fn WakeAllConditionVariable(conditionvariable: *mut RTL_CONDITION_VARIABLE) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn WakeConditionVariable(conditionvariable: *mut RTL_CONDITION_VARIABLE) -> (); +} +#[link(name = "kernel32")] +extern "system" { + pub fn WideCharToMultiByte( + codepage: u32, + dwflags: u32, + lpwidecharstr: PCWSTR, + cchwidechar: i32, + lpmultibytestr: PSTR, + cbmultibyte: i32, + lpdefaultchar: PCSTR, + lpuseddefaultchar: *mut i32, + ) -> i32; +} +#[link(name = "kernel32")] +extern "system" { + pub fn WriteConsoleW( + hconsoleoutput: HANDLE, + lpbuffer: *const ::core::ffi::c_void, + nnumberofcharstowrite: u32, + lpnumberofcharswritten: *mut u32, + lpreserved: *const ::core::ffi::c_void, + ) -> BOOL; +} +#[link(name = "kernel32")] +extern "system" { + pub fn WriteFileEx( + hfile: HANDLE, + lpbuffer: *const u8, + nnumberofbytestowrite: u32, + lpoverlapped: *mut OVERLAPPED, + lpcompletionroutine: LPOVERLAPPED_COMPLETION_ROUTINE, + ) -> BOOL; +} +#[link(name = "ntdll")] +extern "system" { + pub 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; +} +#[link(name = "ntdll")] +extern "system" { + pub 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; +} +#[link(name = "ntdll")] +extern "system" { + pub 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; +} +#[link(name = "ntdll")] +extern "system" { + pub fn RtlNtStatusToDosError(status: NTSTATUS) -> u32; +} +#[link(name = "userenv")] +extern "system" { + pub fn GetUserProfileDirectoryW( + htoken: HANDLE, + lpprofiledir: PWSTR, + lpcchsize: *mut u32, + ) -> BOOL; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn WSACleanup() -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn WSADuplicateSocketW( + s: SOCKET, + dwprocessid: u32, + lpprotocolinfo: *mut WSAPROTOCOL_INFOW, + ) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn WSAGetLastError() -> WSA_ERROR; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn WSARecv( + s: SOCKET, + lpbuffers: *const WSABUF, + dwbuffercount: u32, + lpnumberofbytesrecvd: *mut u32, + lpflags: *mut u32, + lpoverlapped: *mut OVERLAPPED, + lpcompletionroutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn WSASend( + s: SOCKET, + lpbuffers: *const WSABUF, + dwbuffercount: u32, + lpnumberofbytessent: *mut u32, + dwflags: u32, + lpoverlapped: *mut OVERLAPPED, + lpcompletionroutine: LPWSAOVERLAPPED_COMPLETION_ROUTINE, + ) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn WSASocketW( + af: i32, + r#type: i32, + protocol: i32, + lpprotocolinfo: *const WSAPROTOCOL_INFOW, + g: u32, + dwflags: u32, + ) -> SOCKET; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn WSAStartup(wversionrequested: u16, lpwsadata: *mut WSADATA) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn accept(s: SOCKET, addr: *mut SOCKADDR, addrlen: *mut i32) -> SOCKET; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn bind(s: SOCKET, name: *const SOCKADDR, namelen: i32) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn closesocket(s: SOCKET) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn connect(s: SOCKET, name: *const SOCKADDR, namelen: i32) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn freeaddrinfo(paddrinfo: *const ADDRINFOA) -> (); +} +#[link(name = "ws2_32")] +extern "system" { + pub fn getaddrinfo( + pnodename: PCSTR, + pservicename: PCSTR, + phints: *const ADDRINFOA, + ppresult: *mut *mut ADDRINFOA, + ) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn getpeername(s: SOCKET, name: *mut SOCKADDR, namelen: *mut i32) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn getsockname(s: SOCKET, name: *mut SOCKADDR, namelen: *mut i32) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn getsockopt(s: SOCKET, level: i32, optname: i32, optval: PSTR, optlen: *mut i32) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn ioctlsocket(s: SOCKET, cmd: i32, argp: *mut u32) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn listen(s: SOCKET, backlog: i32) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn recv(s: SOCKET, buf: PSTR, len: i32, flags: SEND_RECV_FLAGS) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn recvfrom( + s: SOCKET, + buf: PSTR, + len: i32, + flags: i32, + from: *mut SOCKADDR, + fromlen: *mut i32, + ) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn select( + nfds: i32, + readfds: *mut FD_SET, + writefds: *mut FD_SET, + exceptfds: *mut FD_SET, + timeout: *const TIMEVAL, + ) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn send(s: SOCKET, buf: PCSTR, len: i32, flags: SEND_RECV_FLAGS) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn sendto( + s: SOCKET, + buf: PCSTR, + len: i32, + flags: i32, + to: *const SOCKADDR, + tolen: i32, + ) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn setsockopt(s: SOCKET, level: i32, optname: i32, optval: PCSTR, optlen: i32) -> i32; +} +#[link(name = "ws2_32")] +extern "system" { + pub fn shutdown(s: SOCKET, how: WINSOCK_SHUTDOWN_HOW) -> i32; +} +pub const ABOVE_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32768u32; +pub type ADDRESS_FAMILY = u16; +#[repr(C)] +pub struct ADDRINFOA { + pub ai_flags: i32, + pub ai_family: i32, + pub ai_socktype: i32, + pub ai_protocol: i32, + pub ai_addrlen: usize, + pub ai_canonname: PSTR, + pub ai_addr: *mut SOCKADDR, + pub ai_next: *mut ADDRINFOA, +} +impl ::core::marker::Copy for ADDRINFOA {} +impl ::core::clone::Clone for ADDRINFOA { + fn clone(&self) -> Self { + *self + } +} +pub const AF_INET: ADDRESS_FAMILY = 2u16; +pub const AF_INET6: ADDRESS_FAMILY = 23u16; +pub const AF_UNSPEC: ADDRESS_FAMILY = 0u16; +#[repr(C)] +pub union ARM64_NT_NEON128 { + pub Anonymous: ARM64_NT_NEON128_0, + pub D: [f64; 2], + pub S: [f32; 4], + pub H: [u16; 8], + pub B: [u8; 16], +} +impl ::core::marker::Copy for ARM64_NT_NEON128 {} +impl ::core::clone::Clone for ARM64_NT_NEON128 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct ARM64_NT_NEON128_0 { + pub Low: u64, + pub High: i64, +} +impl ::core::marker::Copy for ARM64_NT_NEON128_0 {} +impl ::core::clone::Clone for ARM64_NT_NEON128_0 { + fn clone(&self) -> Self { + *self + } +} +pub type BCRYPTGENRANDOM_FLAGS = u32; +pub type BCRYPT_ALG_HANDLE = *mut ::core::ffi::c_void; +pub const BCRYPT_USE_SYSTEM_PREFERRED_RNG: BCRYPTGENRANDOM_FLAGS = 2u32; +pub const BELOW_NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 16384u32; +pub type BOOL = i32; +pub type BOOLEAN = u8; +#[repr(C)] +pub struct BY_HANDLE_FILE_INFORMATION { + pub dwFileAttributes: u32, + pub ftCreationTime: FILETIME, + pub ftLastAccessTime: FILETIME, + pub ftLastWriteTime: FILETIME, + pub dwVolumeSerialNumber: u32, + pub nFileSizeHigh: u32, + pub nFileSizeLow: u32, + pub nNumberOfLinks: u32, + pub nFileIndexHigh: u32, + pub nFileIndexLow: u32, +} +impl ::core::marker::Copy for BY_HANDLE_FILE_INFORMATION {} +impl ::core::clone::Clone for BY_HANDLE_FILE_INFORMATION { + fn clone(&self) -> Self { + *self + } +} +pub const CALLBACK_CHUNK_FINISHED: LPPROGRESS_ROUTINE_CALLBACK_REASON = 0u32; +pub const CALLBACK_STREAM_SWITCH: LPPROGRESS_ROUTINE_CALLBACK_REASON = 1u32; +pub type COMPARESTRING_RESULT = u32; +pub type CONSOLE_MODE = u32; +#[repr(C)] +pub struct CONSOLE_READCONSOLE_CONTROL { + pub nLength: u32, + pub nInitialChars: u32, + pub dwCtrlWakeupMask: u32, + pub dwControlKeyState: u32, +} +impl ::core::marker::Copy for CONSOLE_READCONSOLE_CONTROL {} +impl ::core::clone::Clone for CONSOLE_READCONSOLE_CONTROL { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "aarch64")] +pub struct CONTEXT { + pub ContextFlags: u32, + 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], +} +#[cfg(target_arch = "aarch64")] +impl ::core::marker::Copy for CONTEXT {} +#[cfg(target_arch = "aarch64")] +impl ::core::clone::Clone for CONTEXT { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "aarch64")] +pub union CONTEXT_0 { + pub Anonymous: CONTEXT_0_0, + pub X: [u64; 31], +} +#[cfg(target_arch = "aarch64")] +impl ::core::marker::Copy for CONTEXT_0 {} +#[cfg(target_arch = "aarch64")] +impl ::core::clone::Clone for CONTEXT_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "aarch64")] +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, +} +#[cfg(target_arch = "aarch64")] +impl ::core::marker::Copy for CONTEXT_0_0 {} +#[cfg(target_arch = "aarch64")] +impl ::core::clone::Clone for CONTEXT_0_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "x86_64")] +pub struct CONTEXT { + pub P1Home: u64, + pub P2Home: u64, + pub P3Home: u64, + pub P4Home: u64, + pub P5Home: u64, + pub P6Home: u64, + pub ContextFlags: u32, + pub MxCsr: u32, + pub SegCs: u16, + pub SegDs: u16, + pub SegEs: u16, + pub SegFs: u16, + pub SegGs: u16, + pub SegSs: u16, + pub EFlags: u32, + pub Dr0: u64, + pub Dr1: u64, + pub Dr2: u64, + pub Dr3: u64, + pub Dr6: u64, + pub Dr7: u64, + pub Rax: u64, + pub Rcx: u64, + pub Rdx: u64, + pub Rbx: u64, + pub Rsp: u64, + pub Rbp: u64, + pub Rsi: u64, + pub Rdi: u64, + pub R8: u64, + pub R9: u64, + pub R10: u64, + pub R11: u64, + pub R12: u64, + pub R13: u64, + pub R14: u64, + pub R15: u64, + pub Rip: u64, + pub Anonymous: CONTEXT_0, + pub VectorRegister: [M128A; 26], + pub VectorControl: u64, + pub DebugControl: u64, + pub LastBranchToRip: u64, + pub LastBranchFromRip: u64, + pub LastExceptionToRip: u64, + pub LastExceptionFromRip: u64, +} +#[cfg(target_arch = "x86_64")] +impl ::core::marker::Copy for CONTEXT {} +#[cfg(target_arch = "x86_64")] +impl ::core::clone::Clone for CONTEXT { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "x86_64")] +pub union CONTEXT_0 { + pub FltSave: XSAVE_FORMAT, + pub Anonymous: CONTEXT_0_0, +} +#[cfg(target_arch = "x86_64")] +impl ::core::marker::Copy for CONTEXT_0 {} +#[cfg(target_arch = "x86_64")] +impl ::core::clone::Clone for CONTEXT_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "x86_64")] +pub struct CONTEXT_0_0 { + pub Header: [M128A; 2], + pub Legacy: [M128A; 8], + pub Xmm0: M128A, + pub Xmm1: M128A, + pub Xmm2: M128A, + pub Xmm3: M128A, + pub Xmm4: M128A, + pub Xmm5: M128A, + pub Xmm6: M128A, + pub Xmm7: M128A, + pub Xmm8: M128A, + pub Xmm9: M128A, + pub Xmm10: M128A, + pub Xmm11: M128A, + pub Xmm12: M128A, + pub Xmm13: M128A, + pub Xmm14: M128A, + pub Xmm15: M128A, +} +#[cfg(target_arch = "x86_64")] +impl ::core::marker::Copy for CONTEXT_0_0 {} +#[cfg(target_arch = "x86_64")] +impl ::core::clone::Clone for CONTEXT_0_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "x86")] +pub struct CONTEXT { + pub ContextFlags: u32, + 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], +} +#[cfg(target_arch = "x86")] +impl ::core::marker::Copy for CONTEXT {} +#[cfg(target_arch = "x86")] +impl ::core::clone::Clone for CONTEXT { + fn clone(&self) -> Self { + *self + } +} +pub const CP_UTF8: u32 = 65001u32; +pub const CREATE_ALWAYS: FILE_CREATION_DISPOSITION = 2u32; +pub const CREATE_BREAKAWAY_FROM_JOB: PROCESS_CREATION_FLAGS = 16777216u32; +pub const CREATE_DEFAULT_ERROR_MODE: PROCESS_CREATION_FLAGS = 67108864u32; +pub const CREATE_FORCEDOS: PROCESS_CREATION_FLAGS = 8192u32; +pub const CREATE_IGNORE_SYSTEM_DEFAULT: PROCESS_CREATION_FLAGS = 2147483648u32; +pub const CREATE_NEW: FILE_CREATION_DISPOSITION = 1u32; +pub const CREATE_NEW_CONSOLE: PROCESS_CREATION_FLAGS = 16u32; +pub const CREATE_NEW_PROCESS_GROUP: PROCESS_CREATION_FLAGS = 512u32; +pub const CREATE_NO_WINDOW: PROCESS_CREATION_FLAGS = 134217728u32; +pub const CREATE_PRESERVE_CODE_AUTHZ_LEVEL: PROCESS_CREATION_FLAGS = 33554432u32; +pub const CREATE_PROTECTED_PROCESS: PROCESS_CREATION_FLAGS = 262144u32; +pub const CREATE_SECURE_PROCESS: PROCESS_CREATION_FLAGS = 4194304u32; +pub const CREATE_SEPARATE_WOW_VDM: PROCESS_CREATION_FLAGS = 2048u32; +pub const CREATE_SHARED_WOW_VDM: PROCESS_CREATION_FLAGS = 4096u32; +pub const CREATE_SUSPENDED: PROCESS_CREATION_FLAGS = 4u32; +pub const CREATE_UNICODE_ENVIRONMENT: PROCESS_CREATION_FLAGS = 1024u32; +pub const CSTR_EQUAL: COMPARESTRING_RESULT = 2u32; +pub const CSTR_GREATER_THAN: COMPARESTRING_RESULT = 3u32; +pub const CSTR_LESS_THAN: COMPARESTRING_RESULT = 1u32; +pub const DEBUG_ONLY_THIS_PROCESS: PROCESS_CREATION_FLAGS = 2u32; +pub const DEBUG_PROCESS: PROCESS_CREATION_FLAGS = 1u32; +pub const DELETE: FILE_ACCESS_RIGHTS = 65536u32; +pub const DETACHED_PROCESS: PROCESS_CREATION_FLAGS = 8u32; +pub const DISABLE_NEWLINE_AUTO_RETURN: CONSOLE_MODE = 8u32; +pub const DLL_PROCESS_DETACH: u32 = 0u32; +pub const DLL_THREAD_DETACH: u32 = 3u32; +pub const DNS_ERROR_ADDRESS_REQUIRED: WIN32_ERROR = 9573u32; +pub const DNS_ERROR_ALIAS_LOOP: WIN32_ERROR = 9722u32; +pub const DNS_ERROR_AUTOZONE_ALREADY_EXISTS: WIN32_ERROR = 9610u32; +pub const DNS_ERROR_AXFR: WIN32_ERROR = 9752u32; +pub const DNS_ERROR_BACKGROUND_LOADING: WIN32_ERROR = 9568u32; +pub const DNS_ERROR_BAD_KEYMASTER: WIN32_ERROR = 9122u32; +pub const DNS_ERROR_BAD_PACKET: WIN32_ERROR = 9502u32; +pub const DNS_ERROR_CANNOT_FIND_ROOT_HINTS: WIN32_ERROR = 9564u32; +pub const DNS_ERROR_CLIENT_SUBNET_ALREADY_EXISTS: WIN32_ERROR = 9977u32; +pub const DNS_ERROR_CLIENT_SUBNET_DOES_NOT_EXIST: WIN32_ERROR = 9976u32; +pub const DNS_ERROR_CLIENT_SUBNET_IS_ACCESSED: WIN32_ERROR = 9975u32; +pub const DNS_ERROR_CNAME_COLLISION: WIN32_ERROR = 9709u32; +pub const DNS_ERROR_CNAME_LOOP: WIN32_ERROR = 9707u32; +pub const DNS_ERROR_DATAFILE_OPEN_FAILURE: WIN32_ERROR = 9653u32; +pub const DNS_ERROR_DATAFILE_PARSING: WIN32_ERROR = 9655u32; +pub const DNS_ERROR_DEFAULT_SCOPE: WIN32_ERROR = 9960u32; +pub const DNS_ERROR_DEFAULT_VIRTUALIZATION_INSTANCE: WIN32_ERROR = 9925u32; +pub const DNS_ERROR_DEFAULT_ZONESCOPE: WIN32_ERROR = 9953u32; +pub const DNS_ERROR_DELEGATION_REQUIRED: WIN32_ERROR = 9571u32; +pub const DNS_ERROR_DNAME_COLLISION: WIN32_ERROR = 9721u32; +pub const DNS_ERROR_DNSSEC_IS_DISABLED: WIN32_ERROR = 9125u32; +pub const DNS_ERROR_DP_ALREADY_ENLISTED: WIN32_ERROR = 9904u32; +pub const DNS_ERROR_DP_ALREADY_EXISTS: WIN32_ERROR = 9902u32; +pub const DNS_ERROR_DP_DOES_NOT_EXIST: WIN32_ERROR = 9901u32; +pub const DNS_ERROR_DP_FSMO_ERROR: WIN32_ERROR = 9906u32; +pub const DNS_ERROR_DP_NOT_AVAILABLE: WIN32_ERROR = 9905u32; +pub const DNS_ERROR_DP_NOT_ENLISTED: WIN32_ERROR = 9903u32; +pub const DNS_ERROR_DS_UNAVAILABLE: WIN32_ERROR = 9717u32; +pub const DNS_ERROR_DS_ZONE_ALREADY_EXISTS: WIN32_ERROR = 9718u32; +pub const DNS_ERROR_DWORD_VALUE_TOO_LARGE: WIN32_ERROR = 9567u32; +pub const DNS_ERROR_DWORD_VALUE_TOO_SMALL: WIN32_ERROR = 9566u32; +pub const DNS_ERROR_FILE_WRITEBACK_FAILED: WIN32_ERROR = 9654u32; +pub const DNS_ERROR_FORWARDER_ALREADY_EXISTS: WIN32_ERROR = 9619u32; +pub const DNS_ERROR_INCONSISTENT_ROOT_HINTS: WIN32_ERROR = 9565u32; +pub const DNS_ERROR_INVAILD_VIRTUALIZATION_INSTANCE_NAME: WIN32_ERROR = 9924u32; +pub const DNS_ERROR_INVALID_CLIENT_SUBNET_NAME: WIN32_ERROR = 9984u32; +pub const DNS_ERROR_INVALID_DATA: WIN32_ERROR = 13u32; +pub const DNS_ERROR_INVALID_DATAFILE_NAME: WIN32_ERROR = 9652u32; +pub const DNS_ERROR_INVALID_INITIAL_ROLLOVER_OFFSET: WIN32_ERROR = 9115u32; +pub const DNS_ERROR_INVALID_IP_ADDRESS: WIN32_ERROR = 9552u32; +pub const DNS_ERROR_INVALID_KEY_SIZE: WIN32_ERROR = 9106u32; +pub const DNS_ERROR_INVALID_NAME: WIN32_ERROR = 123u32; +pub const DNS_ERROR_INVALID_NAME_CHAR: WIN32_ERROR = 9560u32; +pub const DNS_ERROR_INVALID_NSEC3_ITERATION_COUNT: WIN32_ERROR = 9124u32; +pub const DNS_ERROR_INVALID_POLICY_TABLE: WIN32_ERROR = 9572u32; +pub const DNS_ERROR_INVALID_PROPERTY: WIN32_ERROR = 9553u32; +pub const DNS_ERROR_INVALID_ROLLOVER_PERIOD: WIN32_ERROR = 9114u32; +pub const DNS_ERROR_INVALID_SCOPE_NAME: WIN32_ERROR = 9958u32; +pub const DNS_ERROR_INVALID_SCOPE_OPERATION: WIN32_ERROR = 9961u32; +pub const DNS_ERROR_INVALID_SIGNATURE_VALIDITY_PERIOD: WIN32_ERROR = 9123u32; +pub const DNS_ERROR_INVALID_TYPE: WIN32_ERROR = 9551u32; +pub const DNS_ERROR_INVALID_XML: WIN32_ERROR = 9126u32; +pub const DNS_ERROR_INVALID_ZONESCOPE_NAME: WIN32_ERROR = 9954u32; +pub const DNS_ERROR_INVALID_ZONE_OPERATION: WIN32_ERROR = 9603u32; +pub const DNS_ERROR_INVALID_ZONE_TYPE: WIN32_ERROR = 9611u32; +pub const DNS_ERROR_KEYMASTER_REQUIRED: WIN32_ERROR = 9101u32; +pub const DNS_ERROR_KSP_DOES_NOT_SUPPORT_PROTECTION: WIN32_ERROR = 9108u32; +pub const DNS_ERROR_KSP_NOT_ACCESSIBLE: WIN32_ERROR = 9112u32; +pub const DNS_ERROR_LOAD_ZONESCOPE_FAILED: WIN32_ERROR = 9956u32; +pub const DNS_ERROR_NAME_DOES_NOT_EXIST: WIN32_ERROR = 9714u32; +pub const DNS_ERROR_NAME_NOT_IN_ZONE: WIN32_ERROR = 9706u32; +pub const DNS_ERROR_NBSTAT_INIT_FAILED: WIN32_ERROR = 9617u32; +pub const DNS_ERROR_NEED_SECONDARY_ADDRESSES: WIN32_ERROR = 9614u32; +pub const DNS_ERROR_NEED_WINS_SERVERS: WIN32_ERROR = 9616u32; +pub const DNS_ERROR_NODE_CREATION_FAILED: WIN32_ERROR = 9703u32; +pub const DNS_ERROR_NODE_IS_CNAME: WIN32_ERROR = 9708u32; +pub const DNS_ERROR_NODE_IS_DNAME: WIN32_ERROR = 9720u32; +pub const DNS_ERROR_NON_RFC_NAME: WIN32_ERROR = 9556u32; +pub const DNS_ERROR_NOT_ALLOWED_ON_ACTIVE_SKD: WIN32_ERROR = 9119u32; +pub const DNS_ERROR_NOT_ALLOWED_ON_RODC: WIN32_ERROR = 9569u32; +pub const DNS_ERROR_NOT_ALLOWED_ON_ROOT_SERVER: WIN32_ERROR = 9562u32; +pub const DNS_ERROR_NOT_ALLOWED_ON_SIGNED_ZONE: WIN32_ERROR = 9102u32; +pub const DNS_ERROR_NOT_ALLOWED_ON_UNSIGNED_ZONE: WIN32_ERROR = 9121u32; +pub const DNS_ERROR_NOT_ALLOWED_ON_ZSK: WIN32_ERROR = 9118u32; +pub const DNS_ERROR_NOT_ALLOWED_UNDER_DELEGATION: WIN32_ERROR = 9563u32; +pub const DNS_ERROR_NOT_ALLOWED_UNDER_DNAME: WIN32_ERROR = 9570u32; +pub const DNS_ERROR_NOT_ALLOWED_WITH_ZONESCOPES: WIN32_ERROR = 9955u32; +pub const DNS_ERROR_NOT_ENOUGH_SIGNING_KEY_DESCRIPTORS: WIN32_ERROR = 9104u32; +pub const DNS_ERROR_NOT_UNIQUE: WIN32_ERROR = 9555u32; +pub const DNS_ERROR_NO_BOOTFILE_IF_DS_ZONE: WIN32_ERROR = 9719u32; +pub const DNS_ERROR_NO_CREATE_CACHE_DATA: WIN32_ERROR = 9713u32; +pub const DNS_ERROR_NO_DNS_SERVERS: WIN32_ERROR = 9852u32; +pub const DNS_ERROR_NO_MEMORY: WIN32_ERROR = 14u32; +pub const DNS_ERROR_NO_PACKET: WIN32_ERROR = 9503u32; +pub const DNS_ERROR_NO_TCPIP: WIN32_ERROR = 9851u32; +pub const DNS_ERROR_NO_VALID_TRUST_ANCHORS: WIN32_ERROR = 9127u32; +pub const DNS_ERROR_NO_ZONE_INFO: WIN32_ERROR = 9602u32; +pub const DNS_ERROR_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1: WIN32_ERROR = 9103u32; +pub const DNS_ERROR_NSEC3_NAME_COLLISION: WIN32_ERROR = 9129u32; +pub const DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1: WIN32_ERROR = 9130u32; +pub const DNS_ERROR_NUMERIC_NAME: WIN32_ERROR = 9561u32; +pub const DNS_ERROR_POLICY_ALREADY_EXISTS: WIN32_ERROR = 9971u32; +pub const DNS_ERROR_POLICY_DOES_NOT_EXIST: WIN32_ERROR = 9972u32; +pub const DNS_ERROR_POLICY_INVALID_CRITERIA: WIN32_ERROR = 9973u32; +pub const DNS_ERROR_POLICY_INVALID_CRITERIA_CLIENT_SUBNET: WIN32_ERROR = 9990u32; +pub const DNS_ERROR_POLICY_INVALID_CRITERIA_FQDN: WIN32_ERROR = 9994u32; +pub const DNS_ERROR_POLICY_INVALID_CRITERIA_INTERFACE: WIN32_ERROR = 9993u32; +pub const DNS_ERROR_POLICY_INVALID_CRITERIA_NETWORK_PROTOCOL: WIN32_ERROR = 9992u32; +pub const DNS_ERROR_POLICY_INVALID_CRITERIA_QUERY_TYPE: WIN32_ERROR = 9995u32; +pub const DNS_ERROR_POLICY_INVALID_CRITERIA_TIME_OF_DAY: WIN32_ERROR = 9996u32; +pub const DNS_ERROR_POLICY_INVALID_CRITERIA_TRANSPORT_PROTOCOL: WIN32_ERROR = 9991u32; +pub const DNS_ERROR_POLICY_INVALID_NAME: WIN32_ERROR = 9982u32; +pub const DNS_ERROR_POLICY_INVALID_SETTINGS: WIN32_ERROR = 9974u32; +pub const DNS_ERROR_POLICY_INVALID_WEIGHT: WIN32_ERROR = 9981u32; +pub const DNS_ERROR_POLICY_LOCKED: WIN32_ERROR = 9980u32; +pub const DNS_ERROR_POLICY_MISSING_CRITERIA: WIN32_ERROR = 9983u32; +pub const DNS_ERROR_POLICY_PROCESSING_ORDER_INVALID: WIN32_ERROR = 9985u32; +pub const DNS_ERROR_POLICY_SCOPE_MISSING: WIN32_ERROR = 9986u32; +pub const DNS_ERROR_POLICY_SCOPE_NOT_ALLOWED: WIN32_ERROR = 9987u32; +pub const DNS_ERROR_PRIMARY_REQUIRES_DATAFILE: WIN32_ERROR = 9651u32; +pub const DNS_ERROR_RCODE: WIN32_ERROR = 9504u32; +pub const DNS_ERROR_RCODE_BADKEY: WIN32_ERROR = 9017u32; +pub const DNS_ERROR_RCODE_BADSIG: WIN32_ERROR = 9016u32; +pub const DNS_ERROR_RCODE_BADTIME: WIN32_ERROR = 9018u32; +pub const DNS_ERROR_RCODE_FORMAT_ERROR: WIN32_ERROR = 9001u32; +pub const DNS_ERROR_RCODE_NAME_ERROR: WIN32_ERROR = 9003u32; +pub const DNS_ERROR_RCODE_NOTAUTH: WIN32_ERROR = 9009u32; +pub const DNS_ERROR_RCODE_NOTZONE: WIN32_ERROR = 9010u32; +pub const DNS_ERROR_RCODE_NOT_IMPLEMENTED: WIN32_ERROR = 9004u32; +pub const DNS_ERROR_RCODE_NXRRSET: WIN32_ERROR = 9008u32; +pub const DNS_ERROR_RCODE_REFUSED: WIN32_ERROR = 9005u32; +pub const DNS_ERROR_RCODE_SERVER_FAILURE: WIN32_ERROR = 9002u32; +pub const DNS_ERROR_RCODE_YXDOMAIN: WIN32_ERROR = 9006u32; +pub const DNS_ERROR_RCODE_YXRRSET: WIN32_ERROR = 9007u32; +pub const DNS_ERROR_RECORD_ALREADY_EXISTS: WIN32_ERROR = 9711u32; +pub const DNS_ERROR_RECORD_DOES_NOT_EXIST: WIN32_ERROR = 9701u32; +pub const DNS_ERROR_RECORD_FORMAT: WIN32_ERROR = 9702u32; +pub const DNS_ERROR_RECORD_ONLY_AT_ZONE_ROOT: WIN32_ERROR = 9710u32; +pub const DNS_ERROR_RECORD_TIMED_OUT: WIN32_ERROR = 9705u32; +pub const DNS_ERROR_ROLLOVER_ALREADY_QUEUED: WIN32_ERROR = 9120u32; +pub const DNS_ERROR_ROLLOVER_IN_PROGRESS: WIN32_ERROR = 9116u32; +pub const DNS_ERROR_ROLLOVER_NOT_POKEABLE: WIN32_ERROR = 9128u32; +pub const DNS_ERROR_RRL_INVALID_IPV4_PREFIX: WIN32_ERROR = 9913u32; +pub const DNS_ERROR_RRL_INVALID_IPV6_PREFIX: WIN32_ERROR = 9914u32; +pub const DNS_ERROR_RRL_INVALID_LEAK_RATE: WIN32_ERROR = 9916u32; +pub const DNS_ERROR_RRL_INVALID_TC_RATE: WIN32_ERROR = 9915u32; +pub const DNS_ERROR_RRL_INVALID_WINDOW_SIZE: WIN32_ERROR = 9912u32; +pub const DNS_ERROR_RRL_LEAK_RATE_LESSTHAN_TC_RATE: WIN32_ERROR = 9917u32; +pub const DNS_ERROR_RRL_NOT_ENABLED: WIN32_ERROR = 9911u32; +pub const DNS_ERROR_SCOPE_ALREADY_EXISTS: WIN32_ERROR = 9963u32; +pub const DNS_ERROR_SCOPE_DOES_NOT_EXIST: WIN32_ERROR = 9959u32; +pub const DNS_ERROR_SCOPE_LOCKED: WIN32_ERROR = 9962u32; +pub const DNS_ERROR_SECONDARY_DATA: WIN32_ERROR = 9712u32; +pub const DNS_ERROR_SECONDARY_REQUIRES_MASTER_IP: WIN32_ERROR = 9612u32; +pub const DNS_ERROR_SERVERSCOPE_IS_REFERENCED: WIN32_ERROR = 9988u32; +pub const DNS_ERROR_SIGNING_KEY_NOT_ACCESSIBLE: WIN32_ERROR = 9107u32; +pub const DNS_ERROR_SOA_DELETE_INVALID: WIN32_ERROR = 9618u32; +pub const DNS_ERROR_STANDBY_KEY_NOT_PRESENT: WIN32_ERROR = 9117u32; +pub const DNS_ERROR_SUBNET_ALREADY_EXISTS: WIN32_ERROR = 9979u32; +pub const DNS_ERROR_SUBNET_DOES_NOT_EXIST: WIN32_ERROR = 9978u32; +pub const DNS_ERROR_TOO_MANY_SKDS: WIN32_ERROR = 9113u32; +pub const DNS_ERROR_TRY_AGAIN_LATER: WIN32_ERROR = 9554u32; +pub const DNS_ERROR_UNEXPECTED_CNG_ERROR: WIN32_ERROR = 9110u32; +pub const DNS_ERROR_UNEXPECTED_DATA_PROTECTION_ERROR: WIN32_ERROR = 9109u32; +pub const DNS_ERROR_UNKNOWN_RECORD_TYPE: WIN32_ERROR = 9704u32; +pub const DNS_ERROR_UNKNOWN_SIGNING_PARAMETER_VERSION: WIN32_ERROR = 9111u32; +pub const DNS_ERROR_UNSECURE_PACKET: WIN32_ERROR = 9505u32; +pub const DNS_ERROR_UNSUPPORTED_ALGORITHM: WIN32_ERROR = 9105u32; +pub const DNS_ERROR_VIRTUALIZATION_INSTANCE_ALREADY_EXISTS: WIN32_ERROR = 9921u32; +pub const DNS_ERROR_VIRTUALIZATION_INSTANCE_DOES_NOT_EXIST: WIN32_ERROR = 9922u32; +pub const DNS_ERROR_VIRTUALIZATION_TREE_LOCKED: WIN32_ERROR = 9923u32; +pub const DNS_ERROR_WINS_INIT_FAILED: WIN32_ERROR = 9615u32; +pub const DNS_ERROR_ZONESCOPE_ALREADY_EXISTS: WIN32_ERROR = 9951u32; +pub const DNS_ERROR_ZONESCOPE_DOES_NOT_EXIST: WIN32_ERROR = 9952u32; +pub const DNS_ERROR_ZONESCOPE_FILE_WRITEBACK_FAILED: WIN32_ERROR = 9957u32; +pub const DNS_ERROR_ZONESCOPE_IS_REFERENCED: WIN32_ERROR = 9989u32; +pub const DNS_ERROR_ZONE_ALREADY_EXISTS: WIN32_ERROR = 9609u32; +pub const DNS_ERROR_ZONE_CONFIGURATION_ERROR: WIN32_ERROR = 9604u32; +pub const DNS_ERROR_ZONE_CREATION_FAILED: WIN32_ERROR = 9608u32; +pub const DNS_ERROR_ZONE_DOES_NOT_EXIST: WIN32_ERROR = 9601u32; +pub const DNS_ERROR_ZONE_HAS_NO_NS_RECORDS: WIN32_ERROR = 9606u32; +pub const DNS_ERROR_ZONE_HAS_NO_SOA_RECORD: WIN32_ERROR = 9605u32; +pub const DNS_ERROR_ZONE_IS_SHUTDOWN: WIN32_ERROR = 9621u32; +pub const DNS_ERROR_ZONE_LOCKED: WIN32_ERROR = 9607u32; +pub const DNS_ERROR_ZONE_LOCKED_FOR_SIGNING: WIN32_ERROR = 9622u32; +pub const DNS_ERROR_ZONE_NOT_SECONDARY: WIN32_ERROR = 9613u32; +pub const DNS_ERROR_ZONE_REQUIRES_MASTER_IP: WIN32_ERROR = 9620u32; +pub const DUPLICATE_CLOSE_SOURCE: DUPLICATE_HANDLE_OPTIONS = 1u32; +pub type DUPLICATE_HANDLE_OPTIONS = u32; +pub const DUPLICATE_SAME_ACCESS: DUPLICATE_HANDLE_OPTIONS = 2u32; +pub const ENABLE_AUTO_POSITION: CONSOLE_MODE = 256u32; +pub const ENABLE_ECHO_INPUT: CONSOLE_MODE = 4u32; +pub const ENABLE_EXTENDED_FLAGS: CONSOLE_MODE = 128u32; +pub const ENABLE_INSERT_MODE: CONSOLE_MODE = 32u32; +pub const ENABLE_LINE_INPUT: CONSOLE_MODE = 2u32; +pub const ENABLE_LVB_GRID_WORLDWIDE: CONSOLE_MODE = 16u32; +pub const ENABLE_MOUSE_INPUT: CONSOLE_MODE = 16u32; +pub const ENABLE_PROCESSED_INPUT: CONSOLE_MODE = 1u32; +pub const ENABLE_PROCESSED_OUTPUT: CONSOLE_MODE = 1u32; +pub const ENABLE_QUICK_EDIT_MODE: CONSOLE_MODE = 64u32; +pub const ENABLE_VIRTUAL_TERMINAL_INPUT: CONSOLE_MODE = 512u32; +pub const ENABLE_VIRTUAL_TERMINAL_PROCESSING: CONSOLE_MODE = 4u32; +pub const ENABLE_WINDOW_INPUT: CONSOLE_MODE = 8u32; +pub const ENABLE_WRAP_AT_EOL_OUTPUT: CONSOLE_MODE = 2u32; +pub const ERROR_ABANDONED_WAIT_0: WIN32_ERROR = 735u32; +pub const ERROR_ABANDONED_WAIT_63: WIN32_ERROR = 736u32; +pub const ERROR_ABANDON_HIBERFILE: WIN32_ERROR = 787u32; +pub const ERROR_ABIOS_ERROR: WIN32_ERROR = 538u32; +pub const ERROR_ACCESS_AUDIT_BY_POLICY: WIN32_ERROR = 785u32; +pub const ERROR_ACCESS_DENIED: WIN32_ERROR = 5u32; +pub const ERROR_ACCESS_DENIED_APPDATA: WIN32_ERROR = 502u32; +pub const ERROR_ACCESS_DISABLED_BY_POLICY: WIN32_ERROR = 1260u32; +pub const ERROR_ACCESS_DISABLED_NO_SAFER_UI_BY_POLICY: WIN32_ERROR = 786u32; +pub const ERROR_ACCESS_DISABLED_WEBBLADE: WIN32_ERROR = 1277u32; +pub const ERROR_ACCESS_DISABLED_WEBBLADE_TAMPER: WIN32_ERROR = 1278u32; +pub const ERROR_ACCOUNT_DISABLED: WIN32_ERROR = 1331u32; +pub const ERROR_ACCOUNT_EXPIRED: WIN32_ERROR = 1793u32; +pub const ERROR_ACCOUNT_LOCKED_OUT: WIN32_ERROR = 1909u32; +pub const ERROR_ACCOUNT_RESTRICTION: WIN32_ERROR = 1327u32; +pub const ERROR_ACPI_ERROR: WIN32_ERROR = 669u32; +pub const ERROR_ACTIVE_CONNECTIONS: WIN32_ERROR = 2402u32; +pub const ERROR_ADAP_HDW_ERR: WIN32_ERROR = 57u32; +pub const ERROR_ADDRESS_ALREADY_ASSOCIATED: WIN32_ERROR = 1227u32; +pub const ERROR_ADDRESS_NOT_ASSOCIATED: WIN32_ERROR = 1228u32; +pub const ERROR_ALERTED: WIN32_ERROR = 739u32; +pub const ERROR_ALIAS_EXISTS: WIN32_ERROR = 1379u32; +pub const ERROR_ALLOCATE_BUCKET: WIN32_ERROR = 602u32; +pub const ERROR_ALLOTTED_SPACE_EXCEEDED: WIN32_ERROR = 1344u32; +pub const ERROR_ALL_USER_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1933u32; +pub const ERROR_ALREADY_ASSIGNED: WIN32_ERROR = 85u32; +pub const ERROR_ALREADY_EXISTS: WIN32_ERROR = 183u32; +pub const ERROR_ALREADY_FIBER: WIN32_ERROR = 1280u32; +pub const ERROR_ALREADY_HAS_STREAM_ID: WIN32_ERROR = 4444u32; +pub const ERROR_ALREADY_INITIALIZED: WIN32_ERROR = 1247u32; +pub const ERROR_ALREADY_REGISTERED: WIN32_ERROR = 1242u32; +pub const ERROR_ALREADY_RUNNING_LKG: WIN32_ERROR = 1074u32; +pub const ERROR_ALREADY_THREAD: WIN32_ERROR = 1281u32; +pub const ERROR_ALREADY_WAITING: WIN32_ERROR = 1904u32; +pub const ERROR_ALREADY_WIN32: WIN32_ERROR = 719u32; +pub const ERROR_API_UNAVAILABLE: WIN32_ERROR = 15841u32; +pub const ERROR_APPCONTAINER_REQUIRED: WIN32_ERROR = 4251u32; +pub const ERROR_APPEXEC_APP_COMPAT_BLOCK: WIN32_ERROR = 3068u32; +pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT: WIN32_ERROR = 3069u32; +pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_LICENSING: WIN32_ERROR = 3071u32; +pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_RESOURCES: WIN32_ERROR = 3072u32; +pub const ERROR_APPEXEC_CALLER_WAIT_TIMEOUT_TERMINATION: WIN32_ERROR = 3070u32; +pub const ERROR_APPEXEC_CONDITION_NOT_SATISFIED: WIN32_ERROR = 3060u32; +pub const ERROR_APPEXEC_HANDLE_INVALIDATED: WIN32_ERROR = 3061u32; +pub const ERROR_APPEXEC_HOST_ID_MISMATCH: WIN32_ERROR = 3066u32; +pub const ERROR_APPEXEC_INVALID_HOST_GENERATION: WIN32_ERROR = 3062u32; +pub const ERROR_APPEXEC_INVALID_HOST_STATE: WIN32_ERROR = 3064u32; +pub const ERROR_APPEXEC_NO_DONOR: WIN32_ERROR = 3065u32; +pub const ERROR_APPEXEC_UNEXPECTED_PROCESS_REGISTRATION: WIN32_ERROR = 3063u32; +pub const ERROR_APPEXEC_UNKNOWN_USER: WIN32_ERROR = 3067u32; +pub const ERROR_APPHELP_BLOCK: WIN32_ERROR = 1259u32; +pub const ERROR_APPX_FILE_NOT_ENCRYPTED: WIN32_ERROR = 409u32; +pub const ERROR_APP_HANG: WIN32_ERROR = 1298u32; +pub const ERROR_APP_INIT_FAILURE: WIN32_ERROR = 575u32; +pub const ERROR_APP_WRONG_OS: WIN32_ERROR = 1151u32; +pub const ERROR_ARBITRATION_UNHANDLED: WIN32_ERROR = 723u32; +pub const ERROR_ARENA_TRASHED: WIN32_ERROR = 7u32; +pub const ERROR_ARITHMETIC_OVERFLOW: WIN32_ERROR = 534u32; +pub const ERROR_ASSERTION_FAILURE: WIN32_ERROR = 668u32; +pub const ERROR_ATOMIC_LOCKS_NOT_SUPPORTED: WIN32_ERROR = 174u32; +pub const ERROR_AUDIT_FAILED: WIN32_ERROR = 606u32; +pub const ERROR_AUTHENTICATION_FIREWALL_FAILED: WIN32_ERROR = 1935u32; +pub const ERROR_AUTHIP_FAILURE: WIN32_ERROR = 1469u32; +pub const ERROR_AUTODATASEG_EXCEEDS_64k: WIN32_ERROR = 199u32; +pub const ERROR_BACKUP_CONTROLLER: WIN32_ERROR = 586u32; +pub const ERROR_BADDB: WIN32_ERROR = 1009u32; +pub const ERROR_BADKEY: WIN32_ERROR = 1010u32; +pub const ERROR_BADSTARTPOSITION: WIN32_ERROR = 778u32; +pub const ERROR_BAD_ACCESSOR_FLAGS: WIN32_ERROR = 773u32; +pub const ERROR_BAD_ARGUMENTS: WIN32_ERROR = 160u32; +pub const ERROR_BAD_COMMAND: WIN32_ERROR = 22u32; +pub const ERROR_BAD_COMPRESSION_BUFFER: WIN32_ERROR = 605u32; +pub const ERROR_BAD_CONFIGURATION: WIN32_ERROR = 1610u32; +pub const ERROR_BAD_CURRENT_DIRECTORY: WIN32_ERROR = 703u32; +pub const ERROR_BAD_DESCRIPTOR_FORMAT: WIN32_ERROR = 1361u32; +pub const ERROR_BAD_DEVICE: WIN32_ERROR = 1200u32; +pub const ERROR_BAD_DEVICE_PATH: WIN32_ERROR = 330u32; +pub const ERROR_BAD_DEV_TYPE: WIN32_ERROR = 66u32; +pub const ERROR_BAD_DLL_ENTRYPOINT: WIN32_ERROR = 609u32; +pub const ERROR_BAD_DRIVER_LEVEL: WIN32_ERROR = 119u32; +pub const ERROR_BAD_ENVIRONMENT: WIN32_ERROR = 10u32; +pub const ERROR_BAD_EXE_FORMAT: WIN32_ERROR = 193u32; +pub const ERROR_BAD_FILE_TYPE: WIN32_ERROR = 222u32; +pub const ERROR_BAD_FORMAT: WIN32_ERROR = 11u32; +pub const ERROR_BAD_FUNCTION_TABLE: WIN32_ERROR = 559u32; +pub const ERROR_BAD_IMPERSONATION_LEVEL: WIN32_ERROR = 1346u32; +pub const ERROR_BAD_INHERITANCE_ACL: WIN32_ERROR = 1340u32; +pub const ERROR_BAD_LENGTH: WIN32_ERROR = 24u32; +pub const ERROR_BAD_LOGON_SESSION_STATE: WIN32_ERROR = 1365u32; +pub const ERROR_BAD_MCFG_TABLE: WIN32_ERROR = 791u32; +pub const ERROR_BAD_NETPATH: WIN32_ERROR = 53u32; +pub const ERROR_BAD_NET_NAME: WIN32_ERROR = 67u32; +pub const ERROR_BAD_NET_RESP: WIN32_ERROR = 58u32; +pub const ERROR_BAD_PATHNAME: WIN32_ERROR = 161u32; +pub const ERROR_BAD_PIPE: WIN32_ERROR = 230u32; +pub const ERROR_BAD_PROFILE: WIN32_ERROR = 1206u32; +pub const ERROR_BAD_PROVIDER: WIN32_ERROR = 1204u32; +pub const ERROR_BAD_QUERY_SYNTAX: WIN32_ERROR = 1615u32; +pub const ERROR_BAD_RECOVERY_POLICY: WIN32_ERROR = 6012u32; +pub const ERROR_BAD_REM_ADAP: WIN32_ERROR = 60u32; +pub const ERROR_BAD_SERVICE_ENTRYPOINT: WIN32_ERROR = 610u32; +pub const ERROR_BAD_STACK: WIN32_ERROR = 543u32; +pub const ERROR_BAD_THREADID_ADDR: WIN32_ERROR = 159u32; +pub const ERROR_BAD_TOKEN_TYPE: WIN32_ERROR = 1349u32; +pub const ERROR_BAD_UNIT: WIN32_ERROR = 20u32; +pub const ERROR_BAD_USERNAME: WIN32_ERROR = 2202u32; +pub const ERROR_BAD_USER_PROFILE: WIN32_ERROR = 1253u32; +pub const ERROR_BAD_VALIDATION_CLASS: WIN32_ERROR = 1348u32; +pub const ERROR_BEGINNING_OF_MEDIA: WIN32_ERROR = 1102u32; +pub const ERROR_BEYOND_VDL: WIN32_ERROR = 1289u32; +pub const ERROR_BIOS_FAILED_TO_CONNECT_INTERRUPT: WIN32_ERROR = 585u32; +pub const ERROR_BLOCKED_BY_PARENTAL_CONTROLS: WIN32_ERROR = 346u32; +pub const ERROR_BLOCK_SHARED: WIN32_ERROR = 514u32; +pub const ERROR_BLOCK_SOURCE_WEAK_REFERENCE_INVALID: WIN32_ERROR = 512u32; +pub const ERROR_BLOCK_TARGET_WEAK_REFERENCE_INVALID: WIN32_ERROR = 513u32; +pub const ERROR_BLOCK_TOO_MANY_REFERENCES: WIN32_ERROR = 347u32; +pub const ERROR_BLOCK_WEAK_REFERENCE_INVALID: WIN32_ERROR = 511u32; +pub const ERROR_BOOT_ALREADY_ACCEPTED: WIN32_ERROR = 1076u32; +pub const ERROR_BROKEN_PIPE: WIN32_ERROR = 109u32; +pub const ERROR_BUFFER_ALL_ZEROS: WIN32_ERROR = 754u32; +pub const ERROR_BUFFER_OVERFLOW: WIN32_ERROR = 111u32; +pub const ERROR_BUSY: WIN32_ERROR = 170u32; +pub const ERROR_BUSY_DRIVE: WIN32_ERROR = 142u32; +pub const ERROR_BUS_RESET: WIN32_ERROR = 1111u32; +pub const ERROR_BYPASSIO_FLT_NOT_SUPPORTED: WIN32_ERROR = 506u32; +pub const ERROR_CACHE_PAGE_LOCKED: WIN32_ERROR = 752u32; +pub const ERROR_CALLBACK_INVOKE_INLINE: WIN32_ERROR = 812u32; +pub const ERROR_CALLBACK_POP_STACK: WIN32_ERROR = 768u32; +pub const ERROR_CALLBACK_SUPPLIED_INVALID_DATA: WIN32_ERROR = 1273u32; +pub const ERROR_CALL_NOT_IMPLEMENTED: WIN32_ERROR = 120u32; +pub const ERROR_CANCELLED: WIN32_ERROR = 1223u32; +pub const ERROR_CANCEL_VIOLATION: WIN32_ERROR = 173u32; +pub const ERROR_CANNOT_BREAK_OPLOCK: WIN32_ERROR = 802u32; +pub const ERROR_CANNOT_COPY: WIN32_ERROR = 266u32; +pub const ERROR_CANNOT_DETECT_DRIVER_FAILURE: WIN32_ERROR = 1080u32; +pub const ERROR_CANNOT_DETECT_PROCESS_ABORT: WIN32_ERROR = 1081u32; +pub const ERROR_CANNOT_FIND_WND_CLASS: WIN32_ERROR = 1407u32; +pub const ERROR_CANNOT_GRANT_REQUESTED_OPLOCK: WIN32_ERROR = 801u32; +pub const ERROR_CANNOT_IMPERSONATE: WIN32_ERROR = 1368u32; +pub const ERROR_CANNOT_LOAD_REGISTRY_FILE: WIN32_ERROR = 589u32; +pub const ERROR_CANNOT_MAKE: WIN32_ERROR = 82u32; +pub const ERROR_CANNOT_OPEN_PROFILE: WIN32_ERROR = 1205u32; +pub const ERROR_CANTFETCHBACKWARDS: WIN32_ERROR = 770u32; +pub const ERROR_CANTOPEN: WIN32_ERROR = 1011u32; +pub const ERROR_CANTREAD: WIN32_ERROR = 1012u32; +pub const ERROR_CANTSCROLLBACKWARDS: WIN32_ERROR = 771u32; +pub const ERROR_CANTWRITE: WIN32_ERROR = 1013u32; +pub const ERROR_CANT_ACCESS_DOMAIN_INFO: WIN32_ERROR = 1351u32; +pub const ERROR_CANT_ACCESS_FILE: WIN32_ERROR = 1920u32; +pub const ERROR_CANT_CLEAR_ENCRYPTION_FLAG: WIN32_ERROR = 432u32; +pub const ERROR_CANT_DISABLE_MANDATORY: WIN32_ERROR = 1310u32; +pub const ERROR_CANT_ENABLE_DENY_ONLY: WIN32_ERROR = 629u32; +pub const ERROR_CANT_OPEN_ANONYMOUS: WIN32_ERROR = 1347u32; +pub const ERROR_CANT_RESOLVE_FILENAME: WIN32_ERROR = 1921u32; +pub const ERROR_CANT_TERMINATE_SELF: WIN32_ERROR = 555u32; +pub const ERROR_CANT_WAIT: WIN32_ERROR = 554u32; +pub const ERROR_CAN_NOT_COMPLETE: WIN32_ERROR = 1003u32; +pub const ERROR_CAPAUTHZ_CHANGE_TYPE: WIN32_ERROR = 451u32; +pub const ERROR_CAPAUTHZ_DB_CORRUPTED: WIN32_ERROR = 455u32; +pub const ERROR_CAPAUTHZ_NOT_AUTHORIZED: WIN32_ERROR = 453u32; +pub const ERROR_CAPAUTHZ_NOT_DEVUNLOCKED: WIN32_ERROR = 450u32; +pub const ERROR_CAPAUTHZ_NOT_PROVISIONED: WIN32_ERROR = 452u32; +pub const ERROR_CAPAUTHZ_NO_POLICY: WIN32_ERROR = 454u32; +pub const ERROR_CAPAUTHZ_SCCD_DEV_MODE_REQUIRED: WIN32_ERROR = 459u32; +pub const ERROR_CAPAUTHZ_SCCD_INVALID_CATALOG: WIN32_ERROR = 456u32; +pub const ERROR_CAPAUTHZ_SCCD_NO_AUTH_ENTITY: WIN32_ERROR = 457u32; +pub const ERROR_CAPAUTHZ_SCCD_NO_CAPABILITY_MATCH: WIN32_ERROR = 460u32; +pub const ERROR_CAPAUTHZ_SCCD_PARSE_ERROR: WIN32_ERROR = 458u32; +pub const ERROR_CARDBUS_NOT_SUPPORTED: WIN32_ERROR = 724u32; +pub const ERROR_CASE_DIFFERING_NAMES_IN_DIR: WIN32_ERROR = 424u32; +pub const ERROR_CASE_SENSITIVE_PATH: WIN32_ERROR = 442u32; +pub const ERROR_CERTIFICATE_VALIDATION_PREFERENCE_CONFLICT: WIN32_ERROR = 817u32; +pub const ERROR_CHECKING_FILE_SYSTEM: WIN32_ERROR = 712u32; +pub const ERROR_CHECKOUT_REQUIRED: WIN32_ERROR = 221u32; +pub const ERROR_CHILD_MUST_BE_VOLATILE: WIN32_ERROR = 1021u32; +pub const ERROR_CHILD_NOT_COMPLETE: WIN32_ERROR = 129u32; +pub const ERROR_CHILD_PROCESS_BLOCKED: WIN32_ERROR = 367u32; +pub const ERROR_CHILD_WINDOW_MENU: WIN32_ERROR = 1436u32; +pub const ERROR_CIMFS_IMAGE_CORRUPT: WIN32_ERROR = 470u32; +pub const ERROR_CIMFS_IMAGE_VERSION_NOT_SUPPORTED: WIN32_ERROR = 471u32; +pub const ERROR_CIRCULAR_DEPENDENCY: WIN32_ERROR = 1059u32; +pub const ERROR_CLASS_ALREADY_EXISTS: WIN32_ERROR = 1410u32; +pub const ERROR_CLASS_DOES_NOT_EXIST: WIN32_ERROR = 1411u32; +pub const ERROR_CLASS_HAS_WINDOWS: WIN32_ERROR = 1412u32; +pub const ERROR_CLIENT_SERVER_PARAMETERS_INVALID: WIN32_ERROR = 597u32; +pub const ERROR_CLIPBOARD_NOT_OPEN: WIN32_ERROR = 1418u32; +pub const ERROR_CLOUD_FILE_ACCESS_DENIED: WIN32_ERROR = 395u32; +pub const ERROR_CLOUD_FILE_ALREADY_CONNECTED: WIN32_ERROR = 378u32; +pub const ERROR_CLOUD_FILE_AUTHENTICATION_FAILED: WIN32_ERROR = 386u32; +pub const ERROR_CLOUD_FILE_CONNECTED_PROVIDER_ONLY: WIN32_ERROR = 382u32; +pub const ERROR_CLOUD_FILE_DEHYDRATION_DISALLOWED: WIN32_ERROR = 434u32; +pub const ERROR_CLOUD_FILE_INCOMPATIBLE_HARDLINKS: WIN32_ERROR = 396u32; +pub const ERROR_CLOUD_FILE_INSUFFICIENT_RESOURCES: WIN32_ERROR = 387u32; +pub const ERROR_CLOUD_FILE_INVALID_REQUEST: WIN32_ERROR = 380u32; +pub const ERROR_CLOUD_FILE_IN_USE: WIN32_ERROR = 391u32; +pub const ERROR_CLOUD_FILE_METADATA_CORRUPT: WIN32_ERROR = 363u32; +pub const ERROR_CLOUD_FILE_METADATA_TOO_LARGE: WIN32_ERROR = 364u32; +pub const ERROR_CLOUD_FILE_NETWORK_UNAVAILABLE: WIN32_ERROR = 388u32; +pub const ERROR_CLOUD_FILE_NOT_IN_SYNC: WIN32_ERROR = 377u32; +pub const ERROR_CLOUD_FILE_NOT_SUPPORTED: WIN32_ERROR = 379u32; +pub const ERROR_CLOUD_FILE_NOT_UNDER_SYNC_ROOT: WIN32_ERROR = 390u32; +pub const ERROR_CLOUD_FILE_PINNED: WIN32_ERROR = 392u32; +pub const ERROR_CLOUD_FILE_PROPERTY_BLOB_CHECKSUM_MISMATCH: WIN32_ERROR = 366u32; +pub const ERROR_CLOUD_FILE_PROPERTY_BLOB_TOO_LARGE: WIN32_ERROR = 365u32; +pub const ERROR_CLOUD_FILE_PROPERTY_CORRUPT: WIN32_ERROR = 394u32; +pub const ERROR_CLOUD_FILE_PROPERTY_LOCK_CONFLICT: WIN32_ERROR = 397u32; +pub const ERROR_CLOUD_FILE_PROPERTY_VERSION_NOT_SUPPORTED: WIN32_ERROR = 375u32; +pub const ERROR_CLOUD_FILE_PROVIDER_NOT_RUNNING: WIN32_ERROR = 362u32; +pub const ERROR_CLOUD_FILE_PROVIDER_TERMINATED: WIN32_ERROR = 404u32; +pub const ERROR_CLOUD_FILE_READ_ONLY_VOLUME: WIN32_ERROR = 381u32; +pub const ERROR_CLOUD_FILE_REQUEST_ABORTED: WIN32_ERROR = 393u32; +pub const ERROR_CLOUD_FILE_REQUEST_CANCELED: WIN32_ERROR = 398u32; +pub const ERROR_CLOUD_FILE_REQUEST_TIMEOUT: WIN32_ERROR = 426u32; +pub const ERROR_CLOUD_FILE_SYNC_ROOT_METADATA_CORRUPT: WIN32_ERROR = 358u32; +pub const ERROR_CLOUD_FILE_TOO_MANY_PROPERTY_BLOBS: WIN32_ERROR = 374u32; +pub const ERROR_CLOUD_FILE_UNSUCCESSFUL: WIN32_ERROR = 389u32; +pub const ERROR_CLOUD_FILE_US_MESSAGE_TIMEOUT: WIN32_ERROR = 475u32; +pub const ERROR_CLOUD_FILE_VALIDATION_FAILED: WIN32_ERROR = 383u32; +pub const ERROR_COMMITMENT_LIMIT: WIN32_ERROR = 1455u32; +pub const ERROR_COMMITMENT_MINIMUM: WIN32_ERROR = 635u32; +pub const ERROR_COMPRESSED_FILE_NOT_SUPPORTED: WIN32_ERROR = 335u32; +pub const ERROR_COMPRESSION_DISABLED: WIN32_ERROR = 769u32; +pub const ERROR_COMPRESSION_NOT_BENEFICIAL: WIN32_ERROR = 344u32; +pub const ERROR_CONNECTED_OTHER_PASSWORD: WIN32_ERROR = 2108u32; +pub const ERROR_CONNECTED_OTHER_PASSWORD_DEFAULT: WIN32_ERROR = 2109u32; +pub const ERROR_CONNECTION_ABORTED: WIN32_ERROR = 1236u32; +pub const ERROR_CONNECTION_ACTIVE: WIN32_ERROR = 1230u32; +pub const ERROR_CONNECTION_COUNT_LIMIT: WIN32_ERROR = 1238u32; +pub const ERROR_CONNECTION_INVALID: WIN32_ERROR = 1229u32; +pub const ERROR_CONNECTION_REFUSED: WIN32_ERROR = 1225u32; +pub const ERROR_CONNECTION_UNAVAIL: WIN32_ERROR = 1201u32; +pub const ERROR_CONTAINER_ASSIGNED: WIN32_ERROR = 1504u32; +pub const ERROR_CONTENT_BLOCKED: WIN32_ERROR = 1296u32; +pub const ERROR_CONTEXT_EXPIRED: WIN32_ERROR = 1931u32; +pub const ERROR_CONTINUE: WIN32_ERROR = 1246u32; +pub const ERROR_CONTROL_C_EXIT: WIN32_ERROR = 572u32; +pub const ERROR_CONTROL_ID_NOT_FOUND: WIN32_ERROR = 1421u32; +pub const ERROR_CONVERT_TO_LARGE: WIN32_ERROR = 600u32; +pub const ERROR_CORRUPT_LOG_CLEARED: WIN32_ERROR = 798u32; +pub const ERROR_CORRUPT_LOG_CORRUPTED: WIN32_ERROR = 795u32; +pub const ERROR_CORRUPT_LOG_DELETED_FULL: WIN32_ERROR = 797u32; +pub const ERROR_CORRUPT_LOG_OVERFULL: WIN32_ERROR = 794u32; +pub const ERROR_CORRUPT_LOG_UNAVAILABLE: WIN32_ERROR = 796u32; +pub const ERROR_CORRUPT_SYSTEM_FILE: WIN32_ERROR = 634u32; +pub const ERROR_COULD_NOT_INTERPRET: WIN32_ERROR = 552u32; +pub const ERROR_COUNTER_TIMEOUT: WIN32_ERROR = 1121u32; +pub const ERROR_CPU_SET_INVALID: WIN32_ERROR = 813u32; +pub const ERROR_CRASH_DUMP: WIN32_ERROR = 753u32; +pub const ERROR_CRC: WIN32_ERROR = 23u32; +pub const ERROR_CREATE_FAILED: WIN32_ERROR = 1631u32; +pub const ERROR_CROSS_PARTITION_VIOLATION: WIN32_ERROR = 1661u32; +pub const ERROR_CSCSHARE_OFFLINE: WIN32_ERROR = 1262u32; +pub const ERROR_CS_ENCRYPTION_EXISTING_ENCRYPTED_FILE: WIN32_ERROR = 6019u32; +pub const ERROR_CS_ENCRYPTION_FILE_NOT_CSE: WIN32_ERROR = 6021u32; +pub const ERROR_CS_ENCRYPTION_INVALID_SERVER_RESPONSE: WIN32_ERROR = 6017u32; +pub const ERROR_CS_ENCRYPTION_NEW_ENCRYPTED_FILE: WIN32_ERROR = 6020u32; +pub const ERROR_CS_ENCRYPTION_UNSUPPORTED_SERVER: WIN32_ERROR = 6018u32; +pub const ERROR_CTX_CLIENT_QUERY_TIMEOUT: WIN32_ERROR = 7040u32; +pub const ERROR_CTX_MODEM_RESPONSE_TIMEOUT: WIN32_ERROR = 7012u32; +pub const ERROR_CURRENT_DIRECTORY: WIN32_ERROR = 16u32; +pub const ERROR_CURRENT_DOMAIN_NOT_ALLOWED: WIN32_ERROR = 1399u32; +pub const ERROR_DATABASE_DOES_NOT_EXIST: WIN32_ERROR = 1065u32; +pub const ERROR_DATATYPE_MISMATCH: WIN32_ERROR = 1629u32; +pub const ERROR_DATA_CHECKSUM_ERROR: WIN32_ERROR = 323u32; +pub const ERROR_DATA_NOT_ACCEPTED: WIN32_ERROR = 592u32; +pub const ERROR_DAX_MAPPING_EXISTS: WIN32_ERROR = 361u32; +pub const ERROR_DBG_COMMAND_EXCEPTION: WIN32_ERROR = 697u32; +pub const ERROR_DBG_CONTINUE: WIN32_ERROR = 767u32; +pub const ERROR_DBG_CONTROL_BREAK: WIN32_ERROR = 696u32; +pub const ERROR_DBG_CONTROL_C: WIN32_ERROR = 693u32; +pub const ERROR_DBG_EXCEPTION_HANDLED: WIN32_ERROR = 766u32; +pub const ERROR_DBG_EXCEPTION_NOT_HANDLED: WIN32_ERROR = 688u32; +pub const ERROR_DBG_PRINTEXCEPTION_C: WIN32_ERROR = 694u32; +pub const ERROR_DBG_REPLY_LATER: WIN32_ERROR = 689u32; +pub const ERROR_DBG_RIPEXCEPTION: WIN32_ERROR = 695u32; +pub const ERROR_DBG_TERMINATE_PROCESS: WIN32_ERROR = 692u32; +pub const ERROR_DBG_TERMINATE_THREAD: WIN32_ERROR = 691u32; +pub const ERROR_DBG_UNABLE_TO_PROVIDE_HANDLE: WIN32_ERROR = 690u32; +pub const ERROR_DC_NOT_FOUND: WIN32_ERROR = 1425u32; +pub const ERROR_DDE_FAIL: WIN32_ERROR = 1156u32; +pub const ERROR_DEBUGGER_INACTIVE: WIN32_ERROR = 1284u32; +pub const ERROR_DEBUG_ATTACH_FAILED: WIN32_ERROR = 590u32; +pub const ERROR_DECRYPTION_FAILED: WIN32_ERROR = 6001u32; +pub const ERROR_DELAY_LOAD_FAILED: WIN32_ERROR = 1285u32; +pub const ERROR_DELETE_PENDING: WIN32_ERROR = 303u32; +pub const ERROR_DEPENDENT_SERVICES_RUNNING: WIN32_ERROR = 1051u32; +pub const ERROR_DESTINATION_ELEMENT_FULL: WIN32_ERROR = 1161u32; +pub const ERROR_DESTROY_OBJECT_OF_OTHER_THREAD: WIN32_ERROR = 1435u32; +pub const ERROR_DEVICE_ALREADY_ATTACHED: WIN32_ERROR = 548u32; +pub const ERROR_DEVICE_ALREADY_REMEMBERED: WIN32_ERROR = 1202u32; +pub const ERROR_DEVICE_DOOR_OPEN: WIN32_ERROR = 1166u32; +pub const ERROR_DEVICE_ENUMERATION_ERROR: WIN32_ERROR = 648u32; +pub const ERROR_DEVICE_FEATURE_NOT_SUPPORTED: WIN32_ERROR = 316u32; +pub const ERROR_DEVICE_HARDWARE_ERROR: WIN32_ERROR = 483u32; +pub const ERROR_DEVICE_HINT_NAME_BUFFER_TOO_SMALL: WIN32_ERROR = 355u32; +pub const ERROR_DEVICE_IN_MAINTENANCE: WIN32_ERROR = 359u32; +pub const ERROR_DEVICE_IN_USE: WIN32_ERROR = 2404u32; +pub const ERROR_DEVICE_NOT_CONNECTED: WIN32_ERROR = 1167u32; +pub const ERROR_DEVICE_NOT_PARTITIONED: WIN32_ERROR = 1107u32; +pub const ERROR_DEVICE_NO_RESOURCES: WIN32_ERROR = 322u32; +pub const ERROR_DEVICE_REINITIALIZATION_NEEDED: WIN32_ERROR = 1164u32; +pub const ERROR_DEVICE_REMOVED: WIN32_ERROR = 1617u32; +pub const ERROR_DEVICE_REQUIRES_CLEANING: WIN32_ERROR = 1165u32; +pub const ERROR_DEVICE_RESET_REQUIRED: WIN32_ERROR = 507u32; +pub const ERROR_DEVICE_SUPPORT_IN_PROGRESS: WIN32_ERROR = 171u32; +pub const ERROR_DEVICE_UNREACHABLE: WIN32_ERROR = 321u32; +pub const ERROR_DEV_NOT_EXIST: WIN32_ERROR = 55u32; +pub const ERROR_DHCP_ADDRESS_CONFLICT: WIN32_ERROR = 4100u32; +pub const ERROR_DIFFERENT_SERVICE_ACCOUNT: WIN32_ERROR = 1079u32; +pub const ERROR_DIRECTORY: WIN32_ERROR = 267u32; +pub const ERROR_DIRECTORY_NOT_SUPPORTED: WIN32_ERROR = 336u32; +pub const ERROR_DIRECT_ACCESS_HANDLE: WIN32_ERROR = 130u32; +pub const ERROR_DIR_EFS_DISALLOWED: WIN32_ERROR = 6010u32; +pub const ERROR_DIR_NOT_EMPTY: WIN32_ERROR = 145u32; +pub const ERROR_DIR_NOT_ROOT: WIN32_ERROR = 144u32; +pub const ERROR_DISCARDED: WIN32_ERROR = 157u32; +pub const ERROR_DISK_CHANGE: WIN32_ERROR = 107u32; +pub const ERROR_DISK_CORRUPT: WIN32_ERROR = 1393u32; +pub const ERROR_DISK_FULL: WIN32_ERROR = 112u32; +pub const ERROR_DISK_OPERATION_FAILED: WIN32_ERROR = 1127u32; +pub const ERROR_DISK_QUOTA_EXCEEDED: WIN32_ERROR = 1295u32; +pub const ERROR_DISK_RECALIBRATE_FAILED: WIN32_ERROR = 1126u32; +pub const ERROR_DISK_REPAIR_DISABLED: WIN32_ERROR = 780u32; +pub const ERROR_DISK_REPAIR_REDIRECTED: WIN32_ERROR = 792u32; +pub const ERROR_DISK_REPAIR_UNSUCCESSFUL: WIN32_ERROR = 793u32; +pub const ERROR_DISK_RESET_FAILED: WIN32_ERROR = 1128u32; +pub const ERROR_DISK_RESOURCES_EXHAUSTED: WIN32_ERROR = 314u32; +pub const ERROR_DISK_TOO_FRAGMENTED: WIN32_ERROR = 302u32; +pub const ERROR_DLL_INIT_FAILED: WIN32_ERROR = 1114u32; +pub const ERROR_DLL_INIT_FAILED_LOGOFF: WIN32_ERROR = 624u32; +pub const ERROR_DLL_MIGHT_BE_INCOMPATIBLE: WIN32_ERROR = 687u32; +pub const ERROR_DLL_MIGHT_BE_INSECURE: WIN32_ERROR = 686u32; +pub const ERROR_DLL_NOT_FOUND: WIN32_ERROR = 1157u32; +pub const ERROR_DLP_POLICY_DENIES_OPERATION: WIN32_ERROR = 446u32; +pub const ERROR_DLP_POLICY_SILENTLY_FAIL: WIN32_ERROR = 449u32; +pub const ERROR_DLP_POLICY_WARNS_AGAINST_OPERATION: WIN32_ERROR = 445u32; +pub const ERROR_DOMAIN_CONTROLLER_EXISTS: WIN32_ERROR = 1250u32; +pub const ERROR_DOMAIN_CONTROLLER_NOT_FOUND: WIN32_ERROR = 1908u32; +pub const ERROR_DOMAIN_CTRLR_CONFIG_ERROR: WIN32_ERROR = 581u32; +pub const ERROR_DOMAIN_EXISTS: WIN32_ERROR = 1356u32; +pub const ERROR_DOMAIN_LIMIT_EXCEEDED: WIN32_ERROR = 1357u32; +pub const ERROR_DOMAIN_SID_SAME_AS_LOCAL_WORKSTATION: WIN32_ERROR = 8644u32; +pub const ERROR_DOMAIN_TRUST_INCONSISTENT: WIN32_ERROR = 1810u32; +pub const ERROR_DOWNGRADE_DETECTED: WIN32_ERROR = 1265u32; +pub const ERROR_DPL_NOT_SUPPORTED_FOR_USER: WIN32_ERROR = 423u32; +pub const ERROR_DRIVERS_LEAKING_LOCKED_PAGES: WIN32_ERROR = 729u32; +pub const ERROR_DRIVER_BLOCKED: WIN32_ERROR = 1275u32; +pub const ERROR_DRIVER_CANCEL_TIMEOUT: WIN32_ERROR = 594u32; +pub const ERROR_DRIVER_DATABASE_ERROR: WIN32_ERROR = 652u32; +pub const ERROR_DRIVER_FAILED_PRIOR_UNLOAD: WIN32_ERROR = 654u32; +pub const ERROR_DRIVER_FAILED_SLEEP: WIN32_ERROR = 633u32; +pub const ERROR_DRIVER_PROCESS_TERMINATED: WIN32_ERROR = 1291u32; +pub const ERROR_DRIVE_LOCKED: WIN32_ERROR = 108u32; +pub const ERROR_DS_ADD_REPLICA_INHIBITED: WIN32_ERROR = 8302u32; +pub const ERROR_DS_ADMIN_LIMIT_EXCEEDED: WIN32_ERROR = 8228u32; +pub const ERROR_DS_AFFECTS_MULTIPLE_DSAS: WIN32_ERROR = 8249u32; +pub const ERROR_DS_AG_CANT_HAVE_UNIVERSAL_MEMBER: WIN32_ERROR = 8578u32; +pub const ERROR_DS_ALIASED_OBJ_MISSING: WIN32_ERROR = 8334u32; +pub const ERROR_DS_ALIAS_DEREF_PROBLEM: WIN32_ERROR = 8244u32; +pub const ERROR_DS_ALIAS_POINTS_TO_ALIAS: WIN32_ERROR = 8336u32; +pub const ERROR_DS_ALIAS_PROBLEM: WIN32_ERROR = 8241u32; +pub const ERROR_DS_ATTRIBUTE_OR_VALUE_EXISTS: WIN32_ERROR = 8205u32; +pub const ERROR_DS_ATTRIBUTE_OWNED_BY_SAM: WIN32_ERROR = 8346u32; +pub const ERROR_DS_ATTRIBUTE_TYPE_UNDEFINED: WIN32_ERROR = 8204u32; +pub const ERROR_DS_ATT_ALREADY_EXISTS: WIN32_ERROR = 8318u32; +pub const ERROR_DS_ATT_IS_NOT_ON_OBJ: WIN32_ERROR = 8310u32; +pub const ERROR_DS_ATT_NOT_DEF_FOR_CLASS: WIN32_ERROR = 8317u32; +pub const ERROR_DS_ATT_NOT_DEF_IN_SCHEMA: WIN32_ERROR = 8303u32; +pub const ERROR_DS_ATT_SCHEMA_REQ_ID: WIN32_ERROR = 8399u32; +pub const ERROR_DS_ATT_SCHEMA_REQ_SYNTAX: WIN32_ERROR = 8416u32; +pub const ERROR_DS_ATT_VAL_ALREADY_EXISTS: WIN32_ERROR = 8323u32; +pub const ERROR_DS_AUDIT_FAILURE: WIN32_ERROR = 8625u32; +pub const ERROR_DS_AUTHORIZATION_FAILED: WIN32_ERROR = 8599u32; +pub const ERROR_DS_AUTH_METHOD_NOT_SUPPORTED: WIN32_ERROR = 8231u32; +pub const ERROR_DS_AUTH_UNKNOWN: WIN32_ERROR = 8234u32; +pub const ERROR_DS_AUX_CLS_TEST_FAIL: WIN32_ERROR = 8389u32; +pub const ERROR_DS_BACKLINK_WITHOUT_LINK: WIN32_ERROR = 8482u32; +pub const ERROR_DS_BAD_ATT_SCHEMA_SYNTAX: WIN32_ERROR = 8400u32; +pub const ERROR_DS_BAD_HIERARCHY_FILE: WIN32_ERROR = 8425u32; +pub const ERROR_DS_BAD_INSTANCE_TYPE: WIN32_ERROR = 8313u32; +pub const ERROR_DS_BAD_NAME_SYNTAX: WIN32_ERROR = 8335u32; +pub const ERROR_DS_BAD_RDN_ATT_ID_SYNTAX: WIN32_ERROR = 8392u32; +pub const ERROR_DS_BUILD_HIERARCHY_TABLE_FAILED: WIN32_ERROR = 8426u32; +pub const ERROR_DS_BUSY: WIN32_ERROR = 8206u32; +pub const ERROR_DS_CANT_ACCESS_REMOTE_PART_OF_AD: WIN32_ERROR = 8585u32; +pub const ERROR_DS_CANT_ADD_ATT_VALUES: WIN32_ERROR = 8320u32; +pub const ERROR_DS_CANT_ADD_SYSTEM_ONLY: WIN32_ERROR = 8358u32; +pub const ERROR_DS_CANT_ADD_TO_GC: WIN32_ERROR = 8550u32; +pub const ERROR_DS_CANT_CACHE_ATT: WIN32_ERROR = 8401u32; +pub const ERROR_DS_CANT_CACHE_CLASS: WIN32_ERROR = 8402u32; +pub const ERROR_DS_CANT_CREATE_IN_NONDOMAIN_NC: WIN32_ERROR = 8553u32; +pub const ERROR_DS_CANT_CREATE_UNDER_SCHEMA: WIN32_ERROR = 8510u32; +pub const ERROR_DS_CANT_DELETE: WIN32_ERROR = 8398u32; +pub const ERROR_DS_CANT_DELETE_DSA_OBJ: WIN32_ERROR = 8340u32; +pub const ERROR_DS_CANT_DEL_MASTER_CROSSREF: WIN32_ERROR = 8375u32; +pub const ERROR_DS_CANT_DEMOTE_WITH_WRITEABLE_NC: WIN32_ERROR = 8604u32; +pub const ERROR_DS_CANT_DEREF_ALIAS: WIN32_ERROR = 8337u32; +pub const ERROR_DS_CANT_DERIVE_SPN_FOR_DELETED_DOMAIN: WIN32_ERROR = 8603u32; +pub const ERROR_DS_CANT_DERIVE_SPN_WITHOUT_SERVER_REF: WIN32_ERROR = 8589u32; +pub const ERROR_DS_CANT_FIND_DC_FOR_SRC_DOMAIN: WIN32_ERROR = 8537u32; +pub const ERROR_DS_CANT_FIND_DSA_OBJ: WIN32_ERROR = 8419u32; +pub const ERROR_DS_CANT_FIND_EXPECTED_NC: WIN32_ERROR = 8420u32; +pub const ERROR_DS_CANT_FIND_NC_IN_CACHE: WIN32_ERROR = 8421u32; +pub const ERROR_DS_CANT_MIX_MASTER_AND_REPS: WIN32_ERROR = 8331u32; +pub const ERROR_DS_CANT_MOD_OBJ_CLASS: WIN32_ERROR = 8215u32; +pub const ERROR_DS_CANT_MOD_PRIMARYGROUPID: WIN32_ERROR = 8506u32; +pub const ERROR_DS_CANT_MOD_SYSTEM_ONLY: WIN32_ERROR = 8369u32; +pub const ERROR_DS_CANT_MOVE_ACCOUNT_GROUP: WIN32_ERROR = 8498u32; +pub const ERROR_DS_CANT_MOVE_APP_BASIC_GROUP: WIN32_ERROR = 8608u32; +pub const ERROR_DS_CANT_MOVE_APP_QUERY_GROUP: WIN32_ERROR = 8609u32; +pub const ERROR_DS_CANT_MOVE_DELETED_OBJECT: WIN32_ERROR = 8489u32; +pub const ERROR_DS_CANT_MOVE_RESOURCE_GROUP: WIN32_ERROR = 8499u32; +pub const ERROR_DS_CANT_ON_NON_LEAF: WIN32_ERROR = 8213u32; +pub const ERROR_DS_CANT_ON_RDN: WIN32_ERROR = 8214u32; +pub const ERROR_DS_CANT_REMOVE_ATT_CACHE: WIN32_ERROR = 8403u32; +pub const ERROR_DS_CANT_REMOVE_CLASS_CACHE: WIN32_ERROR = 8404u32; +pub const ERROR_DS_CANT_REM_MISSING_ATT: WIN32_ERROR = 8324u32; +pub const ERROR_DS_CANT_REM_MISSING_ATT_VAL: WIN32_ERROR = 8325u32; +pub const ERROR_DS_CANT_REPLACE_HIDDEN_REC: WIN32_ERROR = 8424u32; +pub const ERROR_DS_CANT_RETRIEVE_ATTS: WIN32_ERROR = 8481u32; +pub const ERROR_DS_CANT_RETRIEVE_CHILD: WIN32_ERROR = 8422u32; +pub const ERROR_DS_CANT_RETRIEVE_DN: WIN32_ERROR = 8405u32; +pub const ERROR_DS_CANT_RETRIEVE_INSTANCE: WIN32_ERROR = 8407u32; +pub const ERROR_DS_CANT_RETRIEVE_SD: WIN32_ERROR = 8526u32; +pub const ERROR_DS_CANT_START: WIN32_ERROR = 8531u32; +pub const ERROR_DS_CANT_TREE_DELETE_CRITICAL_OBJ: WIN32_ERROR = 8560u32; +pub const ERROR_DS_CANT_WITH_ACCT_GROUP_MEMBERSHPS: WIN32_ERROR = 8493u32; +pub const ERROR_DS_CHILDREN_EXIST: WIN32_ERROR = 8332u32; +pub const ERROR_DS_CLASS_MUST_BE_CONCRETE: WIN32_ERROR = 8359u32; +pub const ERROR_DS_CLASS_NOT_DSA: WIN32_ERROR = 8343u32; +pub const ERROR_DS_CLIENT_LOOP: WIN32_ERROR = 8259u32; +pub const ERROR_DS_CODE_INCONSISTENCY: WIN32_ERROR = 8408u32; +pub const ERROR_DS_COMPARE_FALSE: WIN32_ERROR = 8229u32; +pub const ERROR_DS_COMPARE_TRUE: WIN32_ERROR = 8230u32; +pub const ERROR_DS_CONFIDENTIALITY_REQUIRED: WIN32_ERROR = 8237u32; +pub const ERROR_DS_CONFIG_PARAM_MISSING: WIN32_ERROR = 8427u32; +pub const ERROR_DS_CONSTRAINT_VIOLATION: WIN32_ERROR = 8239u32; +pub const ERROR_DS_CONSTRUCTED_ATT_MOD: WIN32_ERROR = 8475u32; +pub const ERROR_DS_CONTROL_NOT_FOUND: WIN32_ERROR = 8258u32; +pub const ERROR_DS_COULDNT_CONTACT_FSMO: WIN32_ERROR = 8367u32; +pub const ERROR_DS_COULDNT_IDENTIFY_OBJECTS_FOR_TREE_DELETE: WIN32_ERROR = 8503u32; +pub const ERROR_DS_COULDNT_LOCK_TREE_FOR_DELETE: WIN32_ERROR = 8502u32; +pub const ERROR_DS_COULDNT_UPDATE_SPNS: WIN32_ERROR = 8525u32; +pub const ERROR_DS_COUNTING_AB_INDICES_FAILED: WIN32_ERROR = 8428u32; +pub const ERROR_DS_CROSS_DOMAIN_CLEANUP_REQD: WIN32_ERROR = 8491u32; +pub const ERROR_DS_CROSS_DOM_MOVE_ERROR: WIN32_ERROR = 8216u32; +pub const ERROR_DS_CROSS_NC_DN_RENAME: WIN32_ERROR = 8368u32; +pub const ERROR_DS_CROSS_REF_BUSY: WIN32_ERROR = 8602u32; +pub const ERROR_DS_CROSS_REF_EXISTS: WIN32_ERROR = 8374u32; +pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE: WIN32_ERROR = 8495u32; +pub const ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2: WIN32_ERROR = 8586u32; +pub const ERROR_DS_DATABASE_ERROR: WIN32_ERROR = 8409u32; +pub const ERROR_DS_DECODING_ERROR: WIN32_ERROR = 8253u32; +pub const ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED: WIN32_ERROR = 8536u32; +pub const ERROR_DS_DESTINATION_DOMAIN_NOT_IN_FOREST: WIN32_ERROR = 8535u32; +pub const ERROR_DS_DIFFERENT_REPL_EPOCHS: WIN32_ERROR = 8593u32; +pub const ERROR_DS_DISALLOWED_IN_SYSTEM_CONTAINER: WIN32_ERROR = 8615u32; +pub const ERROR_DS_DISALLOWED_NC_REDIRECT: WIN32_ERROR = 8640u32; +pub const ERROR_DS_DNS_LOOKUP_FAILURE: WIN32_ERROR = 8524u32; +pub const ERROR_DS_DOMAIN_NAME_EXISTS_IN_FOREST: WIN32_ERROR = 8634u32; +pub const ERROR_DS_DOMAIN_RENAME_IN_PROGRESS: WIN32_ERROR = 8612u32; +pub const ERROR_DS_DOMAIN_VERSION_TOO_HIGH: WIN32_ERROR = 8564u32; +pub const ERROR_DS_DOMAIN_VERSION_TOO_LOW: WIN32_ERROR = 8566u32; +pub const ERROR_DS_DRA_ABANDON_SYNC: WIN32_ERROR = 8462u32; +pub const ERROR_DS_DRA_ACCESS_DENIED: WIN32_ERROR = 8453u32; +pub const ERROR_DS_DRA_BAD_DN: WIN32_ERROR = 8439u32; +pub const ERROR_DS_DRA_BAD_INSTANCE_TYPE: WIN32_ERROR = 8445u32; +pub const ERROR_DS_DRA_BAD_NC: WIN32_ERROR = 8440u32; +pub const ERROR_DS_DRA_BUSY: WIN32_ERROR = 8438u32; +pub const ERROR_DS_DRA_CONNECTION_FAILED: WIN32_ERROR = 8444u32; +pub const ERROR_DS_DRA_CORRUPT_UTD_VECTOR: WIN32_ERROR = 8629u32; +pub const ERROR_DS_DRA_DB_ERROR: WIN32_ERROR = 8451u32; +pub const ERROR_DS_DRA_DN_EXISTS: WIN32_ERROR = 8441u32; +pub const ERROR_DS_DRA_EARLIER_SCHEMA_CONFLICT: WIN32_ERROR = 8544u32; +pub const ERROR_DS_DRA_EXTN_CONNECTION_FAILED: WIN32_ERROR = 8466u32; +pub const ERROR_DS_DRA_GENERIC: WIN32_ERROR = 8436u32; +pub const ERROR_DS_DRA_INCOMPATIBLE_PARTIAL_SET: WIN32_ERROR = 8464u32; +pub const ERROR_DS_DRA_INCONSISTENT_DIT: WIN32_ERROR = 8443u32; +pub const ERROR_DS_DRA_INTERNAL_ERROR: WIN32_ERROR = 8442u32; +pub const ERROR_DS_DRA_INVALID_PARAMETER: WIN32_ERROR = 8437u32; +pub const ERROR_DS_DRA_MAIL_PROBLEM: WIN32_ERROR = 8447u32; +pub const ERROR_DS_DRA_MISSING_KRBTGT_SECRET: WIN32_ERROR = 8633u32; +pub const ERROR_DS_DRA_MISSING_PARENT: WIN32_ERROR = 8460u32; +pub const ERROR_DS_DRA_NAME_COLLISION: WIN32_ERROR = 8458u32; +pub const ERROR_DS_DRA_NOT_SUPPORTED: WIN32_ERROR = 8454u32; +pub const ERROR_DS_DRA_NO_REPLICA: WIN32_ERROR = 8452u32; +pub const ERROR_DS_DRA_OBJ_IS_REP_SOURCE: WIN32_ERROR = 8450u32; +pub const ERROR_DS_DRA_OBJ_NC_MISMATCH: WIN32_ERROR = 8545u32; +pub const ERROR_DS_DRA_OUT_OF_MEM: WIN32_ERROR = 8446u32; +pub const ERROR_DS_DRA_OUT_SCHEDULE_WINDOW: WIN32_ERROR = 8617u32; +pub const ERROR_DS_DRA_PREEMPTED: WIN32_ERROR = 8461u32; +pub const ERROR_DS_DRA_RECYCLED_TARGET: WIN32_ERROR = 8639u32; +pub const ERROR_DS_DRA_REF_ALREADY_EXISTS: WIN32_ERROR = 8448u32; +pub const ERROR_DS_DRA_REF_NOT_FOUND: WIN32_ERROR = 8449u32; +pub const ERROR_DS_DRA_REPL_PENDING: WIN32_ERROR = 8477u32; +pub const ERROR_DS_DRA_RPC_CANCELLED: WIN32_ERROR = 8455u32; +pub const ERROR_DS_DRA_SCHEMA_CONFLICT: WIN32_ERROR = 8543u32; +pub const ERROR_DS_DRA_SCHEMA_INFO_SHIP: WIN32_ERROR = 8542u32; +pub const ERROR_DS_DRA_SCHEMA_MISMATCH: WIN32_ERROR = 8418u32; +pub const ERROR_DS_DRA_SECRETS_DENIED: WIN32_ERROR = 8630u32; +pub const ERROR_DS_DRA_SHUTDOWN: WIN32_ERROR = 8463u32; +pub const ERROR_DS_DRA_SINK_DISABLED: WIN32_ERROR = 8457u32; +pub const ERROR_DS_DRA_SOURCE_DISABLED: WIN32_ERROR = 8456u32; +pub const ERROR_DS_DRA_SOURCE_IS_PARTIAL_REPLICA: WIN32_ERROR = 8465u32; +pub const ERROR_DS_DRA_SOURCE_REINSTALLED: WIN32_ERROR = 8459u32; +pub const ERROR_DS_DRS_EXTENSIONS_CHANGED: WIN32_ERROR = 8594u32; +pub const ERROR_DS_DSA_MUST_BE_INT_MASTER: WIN32_ERROR = 8342u32; +pub const ERROR_DS_DST_DOMAIN_NOT_NATIVE: WIN32_ERROR = 8496u32; +pub const ERROR_DS_DST_NC_MISMATCH: WIN32_ERROR = 8486u32; +pub const ERROR_DS_DS_REQUIRED: WIN32_ERROR = 8478u32; +pub const ERROR_DS_DUPLICATE_ID_FOUND: WIN32_ERROR = 8605u32; +pub const ERROR_DS_DUP_LDAP_DISPLAY_NAME: WIN32_ERROR = 8382u32; +pub const ERROR_DS_DUP_LINK_ID: WIN32_ERROR = 8468u32; +pub const ERROR_DS_DUP_MAPI_ID: WIN32_ERROR = 8380u32; +pub const ERROR_DS_DUP_MSDS_INTID: WIN32_ERROR = 8597u32; +pub const ERROR_DS_DUP_OID: WIN32_ERROR = 8379u32; +pub const ERROR_DS_DUP_RDN: WIN32_ERROR = 8378u32; +pub const ERROR_DS_DUP_SCHEMA_ID_GUID: WIN32_ERROR = 8381u32; +pub const ERROR_DS_ENCODING_ERROR: WIN32_ERROR = 8252u32; +pub const ERROR_DS_EPOCH_MISMATCH: WIN32_ERROR = 8483u32; +pub const ERROR_DS_EXISTING_AD_CHILD_NC: WIN32_ERROR = 8613u32; +pub const ERROR_DS_EXISTS_IN_AUX_CLS: WIN32_ERROR = 8393u32; +pub const ERROR_DS_EXISTS_IN_MAY_HAVE: WIN32_ERROR = 8386u32; +pub const ERROR_DS_EXISTS_IN_MUST_HAVE: WIN32_ERROR = 8385u32; +pub const ERROR_DS_EXISTS_IN_POSS_SUP: WIN32_ERROR = 8395u32; +pub const ERROR_DS_EXISTS_IN_RDNATTID: WIN32_ERROR = 8598u32; +pub const ERROR_DS_EXISTS_IN_SUB_CLS: WIN32_ERROR = 8394u32; +pub const ERROR_DS_FILTER_UNKNOWN: WIN32_ERROR = 8254u32; +pub const ERROR_DS_FILTER_USES_CONTRUCTED_ATTRS: WIN32_ERROR = 8555u32; +pub const ERROR_DS_FLAT_NAME_EXISTS_IN_FOREST: WIN32_ERROR = 8635u32; +pub const ERROR_DS_FOREST_VERSION_TOO_HIGH: WIN32_ERROR = 8563u32; +pub const ERROR_DS_FOREST_VERSION_TOO_LOW: WIN32_ERROR = 8565u32; +pub const ERROR_DS_GCVERIFY_ERROR: WIN32_ERROR = 8417u32; +pub const ERROR_DS_GC_NOT_AVAILABLE: WIN32_ERROR = 8217u32; +pub const ERROR_DS_GC_REQUIRED: WIN32_ERROR = 8547u32; +pub const ERROR_DS_GENERIC_ERROR: WIN32_ERROR = 8341u32; +pub const ERROR_DS_GLOBAL_CANT_HAVE_CROSSDOMAIN_MEMBER: WIN32_ERROR = 8519u32; +pub const ERROR_DS_GLOBAL_CANT_HAVE_LOCAL_MEMBER: WIN32_ERROR = 8516u32; +pub const ERROR_DS_GLOBAL_CANT_HAVE_UNIVERSAL_MEMBER: WIN32_ERROR = 8517u32; +pub const ERROR_DS_GOVERNSID_MISSING: WIN32_ERROR = 8410u32; +pub const ERROR_DS_GROUP_CONVERSION_ERROR: WIN32_ERROR = 8607u32; +pub const ERROR_DS_HAVE_PRIMARY_MEMBERS: WIN32_ERROR = 8521u32; +pub const ERROR_DS_HIERARCHY_TABLE_MALLOC_FAILED: WIN32_ERROR = 8429u32; +pub const ERROR_DS_HIERARCHY_TABLE_TOO_DEEP: WIN32_ERROR = 8628u32; +pub const ERROR_DS_HIGH_ADLDS_FFL: WIN32_ERROR = 8641u32; +pub const ERROR_DS_HIGH_DSA_VERSION: WIN32_ERROR = 8642u32; +pub const ERROR_DS_ILLEGAL_BASE_SCHEMA_MOD: WIN32_ERROR = 8507u32; +pub const ERROR_DS_ILLEGAL_MOD_OPERATION: WIN32_ERROR = 8311u32; +pub const ERROR_DS_ILLEGAL_SUPERIOR: WIN32_ERROR = 8345u32; +pub const ERROR_DS_ILLEGAL_XDOM_MOVE_OPERATION: WIN32_ERROR = 8492u32; +pub const ERROR_DS_INAPPROPRIATE_AUTH: WIN32_ERROR = 8233u32; +pub const ERROR_DS_INAPPROPRIATE_MATCHING: WIN32_ERROR = 8238u32; +pub const ERROR_DS_INCOMPATIBLE_CONTROLS_USED: WIN32_ERROR = 8574u32; +pub const ERROR_DS_INCOMPATIBLE_VERSION: WIN32_ERROR = 8567u32; +pub const ERROR_DS_INCORRECT_ROLE_OWNER: WIN32_ERROR = 8210u32; +pub const ERROR_DS_INIT_FAILURE: WIN32_ERROR = 8532u32; +pub const ERROR_DS_INIT_FAILURE_CONSOLE: WIN32_ERROR = 8561u32; +pub const ERROR_DS_INSTALL_NO_SCH_VERSION_IN_INIFILE: WIN32_ERROR = 8512u32; +pub const ERROR_DS_INSTALL_NO_SRC_SCH_VERSION: WIN32_ERROR = 8511u32; +pub const ERROR_DS_INSTALL_SCHEMA_MISMATCH: WIN32_ERROR = 8467u32; +pub const ERROR_DS_INSUFFICIENT_ATTR_TO_CREATE_OBJECT: WIN32_ERROR = 8606u32; +pub const ERROR_DS_INSUFF_ACCESS_RIGHTS: WIN32_ERROR = 8344u32; +pub const ERROR_DS_INTERNAL_FAILURE: WIN32_ERROR = 8430u32; +pub const ERROR_DS_INVALID_ATTRIBUTE_SYNTAX: WIN32_ERROR = 8203u32; +pub const ERROR_DS_INVALID_DMD: WIN32_ERROR = 8360u32; +pub const ERROR_DS_INVALID_DN_SYNTAX: WIN32_ERROR = 8242u32; +pub const ERROR_DS_INVALID_GROUP_TYPE: WIN32_ERROR = 8513u32; +pub const ERROR_DS_INVALID_LDAP_DISPLAY_NAME: WIN32_ERROR = 8479u32; +pub const ERROR_DS_INVALID_NAME_FOR_SPN: WIN32_ERROR = 8554u32; +pub const ERROR_DS_INVALID_ROLE_OWNER: WIN32_ERROR = 8366u32; +pub const ERROR_DS_INVALID_SCRIPT: WIN32_ERROR = 8600u32; +pub const ERROR_DS_INVALID_SEARCH_FLAG: WIN32_ERROR = 8500u32; +pub const ERROR_DS_INVALID_SEARCH_FLAG_SUBTREE: WIN32_ERROR = 8626u32; +pub const ERROR_DS_INVALID_SEARCH_FLAG_TUPLE: WIN32_ERROR = 8627u32; +pub const ERROR_DS_IS_LEAF: WIN32_ERROR = 8243u32; +pub const ERROR_DS_KEY_NOT_UNIQUE: WIN32_ERROR = 8527u32; +pub const ERROR_DS_LDAP_SEND_QUEUE_FULL: WIN32_ERROR = 8616u32; +pub const ERROR_DS_LINK_ID_NOT_AVAILABLE: WIN32_ERROR = 8577u32; +pub const ERROR_DS_LOCAL_CANT_HAVE_CROSSDOMAIN_LOCAL_MEMBER: WIN32_ERROR = 8520u32; +pub const ERROR_DS_LOCAL_ERROR: WIN32_ERROR = 8251u32; +pub const ERROR_DS_LOCAL_MEMBER_OF_LOCAL_ONLY: WIN32_ERROR = 8548u32; +pub const ERROR_DS_LOOP_DETECT: WIN32_ERROR = 8246u32; +pub const ERROR_DS_LOW_ADLDS_FFL: WIN32_ERROR = 8643u32; +pub const ERROR_DS_LOW_DSA_VERSION: WIN32_ERROR = 8568u32; +pub const ERROR_DS_MACHINE_ACCOUNT_CREATED_PRENT4: WIN32_ERROR = 8572u32; +pub const ERROR_DS_MACHINE_ACCOUNT_QUOTA_EXCEEDED: WIN32_ERROR = 8557u32; +pub const ERROR_DS_MAPI_ID_NOT_AVAILABLE: WIN32_ERROR = 8632u32; +pub const ERROR_DS_MASTERDSA_REQUIRED: WIN32_ERROR = 8314u32; +pub const ERROR_DS_MAX_OBJ_SIZE_EXCEEDED: WIN32_ERROR = 8304u32; +pub const ERROR_DS_MEMBERSHIP_EVALUATED_LOCALLY: WIN32_ERROR = 8201u32; +pub const ERROR_DS_MISSING_EXPECTED_ATT: WIN32_ERROR = 8411u32; +pub const ERROR_DS_MISSING_FOREST_TRUST: WIN32_ERROR = 8649u32; +pub const ERROR_DS_MISSING_FSMO_SETTINGS: WIN32_ERROR = 8434u32; +pub const ERROR_DS_MISSING_INFRASTRUCTURE_CONTAINER: WIN32_ERROR = 8497u32; +pub const ERROR_DS_MISSING_REQUIRED_ATT: WIN32_ERROR = 8316u32; +pub const ERROR_DS_MISSING_SUPREF: WIN32_ERROR = 8406u32; +pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_FLAG: WIN32_ERROR = 8581u32; +pub const ERROR_DS_MODIFYDN_DISALLOWED_BY_INSTANCE_TYPE: WIN32_ERROR = 8579u32; +pub const ERROR_DS_MODIFYDN_WRONG_GRANDPARENT: WIN32_ERROR = 8582u32; +pub const ERROR_DS_MUST_BE_RUN_ON_DST_DC: WIN32_ERROR = 8558u32; +pub const ERROR_DS_NAME_ERROR_DOMAIN_ONLY: WIN32_ERROR = 8473u32; +pub const ERROR_DS_NAME_ERROR_NOT_FOUND: WIN32_ERROR = 8470u32; +pub const ERROR_DS_NAME_ERROR_NOT_UNIQUE: WIN32_ERROR = 8471u32; +pub const ERROR_DS_NAME_ERROR_NO_MAPPING: WIN32_ERROR = 8472u32; +pub const ERROR_DS_NAME_ERROR_NO_SYNTACTICAL_MAPPING: WIN32_ERROR = 8474u32; +pub const ERROR_DS_NAME_ERROR_RESOLVING: WIN32_ERROR = 8469u32; +pub const ERROR_DS_NAME_ERROR_TRUST_REFERRAL: WIN32_ERROR = 8583u32; +pub const ERROR_DS_NAME_NOT_UNIQUE: WIN32_ERROR = 8571u32; +pub const ERROR_DS_NAME_REFERENCE_INVALID: WIN32_ERROR = 8373u32; +pub const ERROR_DS_NAME_TOO_LONG: WIN32_ERROR = 8348u32; +pub const ERROR_DS_NAME_TOO_MANY_PARTS: WIN32_ERROR = 8347u32; +pub const ERROR_DS_NAME_TYPE_UNKNOWN: WIN32_ERROR = 8351u32; +pub const ERROR_DS_NAME_UNPARSEABLE: WIN32_ERROR = 8350u32; +pub const ERROR_DS_NAME_VALUE_TOO_LONG: WIN32_ERROR = 8349u32; +pub const ERROR_DS_NAMING_MASTER_GC: WIN32_ERROR = 8523u32; +pub const ERROR_DS_NAMING_VIOLATION: WIN32_ERROR = 8247u32; +pub const ERROR_DS_NCNAME_MISSING_CR_REF: WIN32_ERROR = 8412u32; +pub const ERROR_DS_NCNAME_MUST_BE_NC: WIN32_ERROR = 8357u32; +pub const ERROR_DS_NC_MUST_HAVE_NC_PARENT: WIN32_ERROR = 8494u32; +pub const ERROR_DS_NC_STILL_HAS_DSAS: WIN32_ERROR = 8546u32; +pub const ERROR_DS_NONEXISTENT_MAY_HAVE: WIN32_ERROR = 8387u32; +pub const ERROR_DS_NONEXISTENT_MUST_HAVE: WIN32_ERROR = 8388u32; +pub const ERROR_DS_NONEXISTENT_POSS_SUP: WIN32_ERROR = 8390u32; +pub const ERROR_DS_NONSAFE_SCHEMA_CHANGE: WIN32_ERROR = 8508u32; +pub const ERROR_DS_NON_ASQ_SEARCH: WIN32_ERROR = 8624u32; +pub const ERROR_DS_NON_BASE_SEARCH: WIN32_ERROR = 8480u32; +pub const ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX: WIN32_ERROR = 8377u32; +pub const ERROR_DS_NOT_AN_OBJECT: WIN32_ERROR = 8352u32; +pub const ERROR_DS_NOT_AUTHORITIVE_FOR_DST_NC: WIN32_ERROR = 8487u32; +pub const ERROR_DS_NOT_CLOSEST: WIN32_ERROR = 8588u32; +pub const ERROR_DS_NOT_INSTALLED: WIN32_ERROR = 8200u32; +pub const ERROR_DS_NOT_ON_BACKLINK: WIN32_ERROR = 8362u32; +pub const ERROR_DS_NOT_SUPPORTED: WIN32_ERROR = 8256u32; +pub const ERROR_DS_NOT_SUPPORTED_SORT_ORDER: WIN32_ERROR = 8570u32; +pub const ERROR_DS_NO_ATTRIBUTE_OR_VALUE: WIN32_ERROR = 8202u32; +pub const ERROR_DS_NO_BEHAVIOR_VERSION_IN_MIXEDDOMAIN: WIN32_ERROR = 8569u32; +pub const ERROR_DS_NO_CHAINED_EVAL: WIN32_ERROR = 8328u32; +pub const ERROR_DS_NO_CHAINING: WIN32_ERROR = 8327u32; +pub const ERROR_DS_NO_CHECKPOINT_WITH_PDC: WIN32_ERROR = 8551u32; +pub const ERROR_DS_NO_CROSSREF_FOR_NC: WIN32_ERROR = 8363u32; +pub const ERROR_DS_NO_DELETED_NAME: WIN32_ERROR = 8355u32; +pub const ERROR_DS_NO_FPO_IN_UNIVERSAL_GROUPS: WIN32_ERROR = 8549u32; +pub const ERROR_DS_NO_MORE_RIDS: WIN32_ERROR = 8209u32; +pub const ERROR_DS_NO_MSDS_INTID: WIN32_ERROR = 8596u32; +pub const ERROR_DS_NO_NEST_GLOBALGROUP_IN_MIXEDDOMAIN: WIN32_ERROR = 8514u32; +pub const ERROR_DS_NO_NEST_LOCALGROUP_IN_MIXEDDOMAIN: WIN32_ERROR = 8515u32; +pub const ERROR_DS_NO_NTDSA_OBJECT: WIN32_ERROR = 8623u32; +pub const ERROR_DS_NO_OBJECT_MOVE_IN_SCHEMA_NC: WIN32_ERROR = 8580u32; +pub const ERROR_DS_NO_PARENT_OBJECT: WIN32_ERROR = 8329u32; +pub const ERROR_DS_NO_PKT_PRIVACY_ON_CONNECTION: WIN32_ERROR = 8533u32; +pub const ERROR_DS_NO_RDN_DEFINED_IN_SCHEMA: WIN32_ERROR = 8306u32; +pub const ERROR_DS_NO_REF_DOMAIN: WIN32_ERROR = 8575u32; +pub const ERROR_DS_NO_REQUESTED_ATTS_FOUND: WIN32_ERROR = 8308u32; +pub const ERROR_DS_NO_RESULTS_RETURNED: WIN32_ERROR = 8257u32; +pub const ERROR_DS_NO_RIDS_ALLOCATED: WIN32_ERROR = 8208u32; +pub const ERROR_DS_NO_SERVER_OBJECT: WIN32_ERROR = 8622u32; +pub const ERROR_DS_NO_SUCH_OBJECT: WIN32_ERROR = 8240u32; +pub const ERROR_DS_NO_TREE_DELETE_ABOVE_NC: WIN32_ERROR = 8501u32; +pub const ERROR_DS_NTDSCRIPT_PROCESS_ERROR: WIN32_ERROR = 8592u32; +pub const ERROR_DS_NTDSCRIPT_SYNTAX_ERROR: WIN32_ERROR = 8591u32; +pub const ERROR_DS_OBJECT_BEING_REMOVED: WIN32_ERROR = 8339u32; +pub const ERROR_DS_OBJECT_CLASS_REQUIRED: WIN32_ERROR = 8315u32; +pub const ERROR_DS_OBJECT_RESULTS_TOO_LARGE: WIN32_ERROR = 8248u32; +pub const ERROR_DS_OBJ_CLASS_NOT_DEFINED: WIN32_ERROR = 8371u32; +pub const ERROR_DS_OBJ_CLASS_NOT_SUBCLASS: WIN32_ERROR = 8372u32; +pub const ERROR_DS_OBJ_CLASS_VIOLATION: WIN32_ERROR = 8212u32; +pub const ERROR_DS_OBJ_GUID_EXISTS: WIN32_ERROR = 8361u32; +pub const ERROR_DS_OBJ_NOT_FOUND: WIN32_ERROR = 8333u32; +pub const ERROR_DS_OBJ_STRING_NAME_EXISTS: WIN32_ERROR = 8305u32; +pub const ERROR_DS_OBJ_TOO_LARGE: WIN32_ERROR = 8312u32; +pub const ERROR_DS_OFFSET_RANGE_ERROR: WIN32_ERROR = 8262u32; +pub const ERROR_DS_OID_MAPPED_GROUP_CANT_HAVE_MEMBERS: WIN32_ERROR = 8637u32; +pub const ERROR_DS_OID_NOT_FOUND: WIN32_ERROR = 8638u32; +pub const ERROR_DS_OPERATIONS_ERROR: WIN32_ERROR = 8224u32; +pub const ERROR_DS_OUT_OF_SCOPE: WIN32_ERROR = 8338u32; +pub const ERROR_DS_OUT_OF_VERSION_STORE: WIN32_ERROR = 8573u32; +pub const ERROR_DS_PARAM_ERROR: WIN32_ERROR = 8255u32; +pub const ERROR_DS_PARENT_IS_AN_ALIAS: WIN32_ERROR = 8330u32; +pub const ERROR_DS_PDC_OPERATION_IN_PROGRESS: WIN32_ERROR = 8490u32; +pub const ERROR_DS_PER_ATTRIBUTE_AUTHZ_FAILED_DURING_ADD: WIN32_ERROR = 8652u32; +pub const ERROR_DS_POLICY_NOT_KNOWN: WIN32_ERROR = 8618u32; +pub const ERROR_DS_PROTOCOL_ERROR: WIN32_ERROR = 8225u32; +pub const ERROR_DS_RANGE_CONSTRAINT: WIN32_ERROR = 8322u32; +pub const ERROR_DS_RDN_DOESNT_MATCH_SCHEMA: WIN32_ERROR = 8307u32; +pub const ERROR_DS_RECALCSCHEMA_FAILED: WIN32_ERROR = 8396u32; +pub const ERROR_DS_REFERRAL: WIN32_ERROR = 8235u32; +pub const ERROR_DS_REFERRAL_LIMIT_EXCEEDED: WIN32_ERROR = 8260u32; +pub const ERROR_DS_REFUSING_FSMO_ROLES: WIN32_ERROR = 8433u32; +pub const ERROR_DS_REMOTE_CROSSREF_OP_FAILED: WIN32_ERROR = 8601u32; +pub const ERROR_DS_REPLICATOR_ONLY: WIN32_ERROR = 8370u32; +pub const ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR: WIN32_ERROR = 8595u32; +pub const ERROR_DS_REPL_LIFETIME_EXCEEDED: WIN32_ERROR = 8614u32; +pub const ERROR_DS_RESERVED_LINK_ID: WIN32_ERROR = 8576u32; +pub const ERROR_DS_RESERVED_MAPI_ID: WIN32_ERROR = 8631u32; +pub const ERROR_DS_RIDMGR_DISABLED: WIN32_ERROR = 8263u32; +pub const ERROR_DS_RIDMGR_INIT_ERROR: WIN32_ERROR = 8211u32; +pub const ERROR_DS_ROLE_NOT_VERIFIED: WIN32_ERROR = 8610u32; +pub const ERROR_DS_ROOT_CANT_BE_SUBREF: WIN32_ERROR = 8326u32; +pub const ERROR_DS_ROOT_MUST_BE_NC: WIN32_ERROR = 8301u32; +pub const ERROR_DS_ROOT_REQUIRES_CLASS_TOP: WIN32_ERROR = 8432u32; +pub const ERROR_DS_SAM_INIT_FAILURE: WIN32_ERROR = 8504u32; +pub const ERROR_DS_SAM_INIT_FAILURE_CONSOLE: WIN32_ERROR = 8562u32; +pub const ERROR_DS_SAM_NEED_BOOTKEY_FLOPPY: WIN32_ERROR = 8530u32; +pub const ERROR_DS_SAM_NEED_BOOTKEY_PASSWORD: WIN32_ERROR = 8529u32; +pub const ERROR_DS_SCHEMA_ALLOC_FAILED: WIN32_ERROR = 8415u32; +pub const ERROR_DS_SCHEMA_NOT_LOADED: WIN32_ERROR = 8414u32; +pub const ERROR_DS_SCHEMA_UPDATE_DISALLOWED: WIN32_ERROR = 8509u32; +pub const ERROR_DS_SECURITY_CHECKING_ERROR: WIN32_ERROR = 8413u32; +pub const ERROR_DS_SECURITY_ILLEGAL_MODIFY: WIN32_ERROR = 8423u32; +pub const ERROR_DS_SEC_DESC_INVALID: WIN32_ERROR = 8354u32; +pub const ERROR_DS_SEC_DESC_TOO_SHORT: WIN32_ERROR = 8353u32; +pub const ERROR_DS_SEMANTIC_ATT_TEST: WIN32_ERROR = 8383u32; +pub const ERROR_DS_SENSITIVE_GROUP_VIOLATION: WIN32_ERROR = 8505u32; +pub const ERROR_DS_SERVER_DOWN: WIN32_ERROR = 8250u32; +pub const ERROR_DS_SHUTTING_DOWN: WIN32_ERROR = 8364u32; +pub const ERROR_DS_SINGLE_USER_MODE_FAILED: WIN32_ERROR = 8590u32; +pub const ERROR_DS_SINGLE_VALUE_CONSTRAINT: WIN32_ERROR = 8321u32; +pub const ERROR_DS_SIZELIMIT_EXCEEDED: WIN32_ERROR = 8227u32; +pub const ERROR_DS_SORT_CONTROL_MISSING: WIN32_ERROR = 8261u32; +pub const ERROR_DS_SOURCE_AUDITING_NOT_ENABLED: WIN32_ERROR = 8552u32; +pub const ERROR_DS_SOURCE_DOMAIN_IN_FOREST: WIN32_ERROR = 8534u32; +pub const ERROR_DS_SPN_VALUE_NOT_UNIQUE_IN_FOREST: WIN32_ERROR = 8647u32; +pub const ERROR_DS_SRC_AND_DST_NC_IDENTICAL: WIN32_ERROR = 8485u32; +pub const ERROR_DS_SRC_AND_DST_OBJECT_CLASS_MISMATCH: WIN32_ERROR = 8540u32; +pub const ERROR_DS_SRC_DC_MUST_BE_SP4_OR_GREATER: WIN32_ERROR = 8559u32; +pub const ERROR_DS_SRC_GUID_MISMATCH: WIN32_ERROR = 8488u32; +pub const ERROR_DS_SRC_NAME_MISMATCH: WIN32_ERROR = 8484u32; +pub const ERROR_DS_SRC_OBJ_NOT_GROUP_OR_USER: WIN32_ERROR = 8538u32; +pub const ERROR_DS_SRC_SID_EXISTS_IN_FOREST: WIN32_ERROR = 8539u32; +pub const ERROR_DS_STRING_SD_CONVERSION_FAILED: WIN32_ERROR = 8522u32; +pub const ERROR_DS_STRONG_AUTH_REQUIRED: WIN32_ERROR = 8232u32; +pub const ERROR_DS_SUBREF_MUST_HAVE_PARENT: WIN32_ERROR = 8356u32; +pub const ERROR_DS_SUBTREE_NOTIFY_NOT_NC_HEAD: WIN32_ERROR = 8376u32; +pub const ERROR_DS_SUB_CLS_TEST_FAIL: WIN32_ERROR = 8391u32; +pub const ERROR_DS_SYNTAX_MISMATCH: WIN32_ERROR = 8384u32; +pub const ERROR_DS_THREAD_LIMIT_EXCEEDED: WIN32_ERROR = 8587u32; +pub const ERROR_DS_TIMELIMIT_EXCEEDED: WIN32_ERROR = 8226u32; +pub const ERROR_DS_TREE_DELETE_NOT_FINISHED: WIN32_ERROR = 8397u32; +pub const ERROR_DS_UNABLE_TO_SURRENDER_ROLES: WIN32_ERROR = 8435u32; +pub const ERROR_DS_UNAVAILABLE: WIN32_ERROR = 8207u32; +pub const ERROR_DS_UNAVAILABLE_CRIT_EXTENSION: WIN32_ERROR = 8236u32; +pub const ERROR_DS_UNDELETE_SAM_VALIDATION_FAILED: WIN32_ERROR = 8645u32; +pub const ERROR_DS_UNICODEPWD_NOT_IN_QUOTES: WIN32_ERROR = 8556u32; +pub const ERROR_DS_UNIVERSAL_CANT_HAVE_LOCAL_MEMBER: WIN32_ERROR = 8518u32; +pub const ERROR_DS_UNKNOWN_ERROR: WIN32_ERROR = 8431u32; +pub const ERROR_DS_UNKNOWN_OPERATION: WIN32_ERROR = 8365u32; +pub const ERROR_DS_UNWILLING_TO_PERFORM: WIN32_ERROR = 8245u32; +pub const ERROR_DS_UPN_VALUE_NOT_UNIQUE_IN_FOREST: WIN32_ERROR = 8648u32; +pub const ERROR_DS_USER_BUFFER_TO_SMALL: WIN32_ERROR = 8309u32; +pub const ERROR_DS_VALUE_KEY_NOT_UNIQUE: WIN32_ERROR = 8650u32; +pub const ERROR_DS_VERSION_CHECK_FAILURE: WIN32_ERROR = 643u32; +pub const ERROR_DS_WKO_CONTAINER_CANNOT_BE_SPECIAL: WIN32_ERROR = 8611u32; +pub const ERROR_DS_WRONG_LINKED_ATT_SYNTAX: WIN32_ERROR = 8528u32; +pub const ERROR_DS_WRONG_OM_OBJ_CLASS: WIN32_ERROR = 8476u32; +pub const ERROR_DUPLICATE_PRIVILEGES: WIN32_ERROR = 311u32; +pub const ERROR_DUPLICATE_SERVICE_NAME: WIN32_ERROR = 1078u32; +pub const ERROR_DUP_DOMAINNAME: WIN32_ERROR = 1221u32; +pub const ERROR_DUP_NAME: WIN32_ERROR = 52u32; +pub const ERROR_DYNAMIC_CODE_BLOCKED: WIN32_ERROR = 1655u32; +pub const ERROR_DYNLINK_FROM_INVALID_RING: WIN32_ERROR = 196u32; +pub const ERROR_EAS_DIDNT_FIT: WIN32_ERROR = 275u32; +pub const ERROR_EAS_NOT_SUPPORTED: WIN32_ERROR = 282u32; +pub const ERROR_EA_ACCESS_DENIED: WIN32_ERROR = 994u32; +pub const ERROR_EA_FILE_CORRUPT: WIN32_ERROR = 276u32; +pub const ERROR_EA_LIST_INCONSISTENT: WIN32_ERROR = 255u32; +pub const ERROR_EA_TABLE_FULL: WIN32_ERROR = 277u32; +pub const ERROR_EDP_DPL_POLICY_CANT_BE_SATISFIED: WIN32_ERROR = 357u32; +pub const ERROR_EDP_POLICY_DENIES_OPERATION: WIN32_ERROR = 356u32; +pub const ERROR_EFS_ALG_BLOB_TOO_BIG: WIN32_ERROR = 6013u32; +pub const ERROR_EFS_DISABLED: WIN32_ERROR = 6015u32; +pub const ERROR_EFS_SERVER_NOT_TRUSTED: WIN32_ERROR = 6011u32; +pub const ERROR_EFS_VERSION_NOT_SUPPORT: WIN32_ERROR = 6016u32; +pub const ERROR_ELEVATION_REQUIRED: WIN32_ERROR = 740u32; +pub const ERROR_ENCLAVE_FAILURE: WIN32_ERROR = 349u32; +pub const ERROR_ENCLAVE_NOT_TERMINATED: WIN32_ERROR = 814u32; +pub const ERROR_ENCLAVE_VIOLATION: WIN32_ERROR = 815u32; +pub const ERROR_ENCRYPTED_FILE_NOT_SUPPORTED: WIN32_ERROR = 489u32; +pub const ERROR_ENCRYPTED_IO_NOT_POSSIBLE: WIN32_ERROR = 808u32; +pub const ERROR_ENCRYPTING_METADATA_DISALLOWED: WIN32_ERROR = 431u32; +pub const ERROR_ENCRYPTION_DISABLED: WIN32_ERROR = 430u32; +pub const ERROR_ENCRYPTION_FAILED: WIN32_ERROR = 6000u32; +pub const ERROR_ENCRYPTION_POLICY_DENIES_OPERATION: WIN32_ERROR = 6022u32; +pub const ERROR_END_OF_MEDIA: WIN32_ERROR = 1100u32; +pub const ERROR_ENVVAR_NOT_FOUND: WIN32_ERROR = 203u32; +pub const ERROR_EOM_OVERFLOW: WIN32_ERROR = 1129u32; +pub const ERROR_ERRORS_ENCOUNTERED: WIN32_ERROR = 774u32; +pub const ERROR_EVALUATION_EXPIRATION: WIN32_ERROR = 622u32; +pub const ERROR_EVENTLOG_CANT_START: WIN32_ERROR = 1501u32; +pub const ERROR_EVENTLOG_FILE_CHANGED: WIN32_ERROR = 1503u32; +pub const ERROR_EVENTLOG_FILE_CORRUPT: WIN32_ERROR = 1500u32; +pub const ERROR_EVENT_DONE: WIN32_ERROR = 710u32; +pub const ERROR_EVENT_PENDING: WIN32_ERROR = 711u32; +pub const ERROR_EXCEPTION_IN_SERVICE: WIN32_ERROR = 1064u32; +pub const ERROR_EXCL_SEM_ALREADY_OWNED: WIN32_ERROR = 101u32; +pub const ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY: WIN32_ERROR = 217u32; +pub const ERROR_EXE_CANNOT_MODIFY_STRONG_SIGNED_BINARY: WIN32_ERROR = 218u32; +pub const ERROR_EXE_MACHINE_TYPE_MISMATCH: WIN32_ERROR = 216u32; +pub const ERROR_EXE_MARKED_INVALID: WIN32_ERROR = 192u32; +pub const ERROR_EXTENDED_ERROR: WIN32_ERROR = 1208u32; +pub const ERROR_EXTERNAL_BACKING_PROVIDER_UNKNOWN: WIN32_ERROR = 343u32; +pub const ERROR_EXTERNAL_SYSKEY_NOT_SUPPORTED: WIN32_ERROR = 399u32; +pub const ERROR_EXTRANEOUS_INFORMATION: WIN32_ERROR = 677u32; +pub const ERROR_FAILED_DRIVER_ENTRY: WIN32_ERROR = 647u32; +pub const ERROR_FAILED_SERVICE_CONTROLLER_CONNECT: WIN32_ERROR = 1063u32; +pub const ERROR_FAIL_FAST_EXCEPTION: WIN32_ERROR = 1653u32; +pub const ERROR_FAIL_I24: WIN32_ERROR = 83u32; +pub const ERROR_FAIL_NOACTION_REBOOT: WIN32_ERROR = 350u32; +pub const ERROR_FAIL_RESTART: WIN32_ERROR = 352u32; +pub const ERROR_FAIL_SHUTDOWN: WIN32_ERROR = 351u32; +pub const ERROR_FATAL_APP_EXIT: WIN32_ERROR = 713u32; +pub const ERROR_FILEMARK_DETECTED: WIN32_ERROR = 1101u32; +pub const ERROR_FILENAME_EXCED_RANGE: WIN32_ERROR = 206u32; +pub const ERROR_FILE_CHECKED_OUT: WIN32_ERROR = 220u32; +pub const ERROR_FILE_CORRUPT: WIN32_ERROR = 1392u32; +pub const ERROR_FILE_ENCRYPTED: WIN32_ERROR = 6002u32; +pub const ERROR_FILE_EXISTS: WIN32_ERROR = 80u32; +pub const ERROR_FILE_HANDLE_REVOKED: WIN32_ERROR = 806u32; +pub const ERROR_FILE_INVALID: WIN32_ERROR = 1006u32; +pub const ERROR_FILE_LEVEL_TRIM_NOT_SUPPORTED: WIN32_ERROR = 326u32; +pub const ERROR_FILE_METADATA_OPTIMIZATION_IN_PROGRESS: WIN32_ERROR = 809u32; +pub const ERROR_FILE_NOT_ENCRYPTED: WIN32_ERROR = 6007u32; +pub const ERROR_FILE_NOT_FOUND: WIN32_ERROR = 2u32; +pub const ERROR_FILE_NOT_SUPPORTED: WIN32_ERROR = 425u32; +pub const ERROR_FILE_OFFLINE: WIN32_ERROR = 4350u32; +pub const ERROR_FILE_PROTECTED_UNDER_DPL: WIN32_ERROR = 406u32; +pub const ERROR_FILE_READ_ONLY: WIN32_ERROR = 6009u32; +pub const ERROR_FILE_SNAP_INVALID_PARAMETER: WIN32_ERROR = 440u32; +pub const ERROR_FILE_SNAP_IN_PROGRESS: WIN32_ERROR = 435u32; +pub const ERROR_FILE_SNAP_IO_NOT_COORDINATED: WIN32_ERROR = 438u32; +pub const ERROR_FILE_SNAP_MODIFY_NOT_SUPPORTED: WIN32_ERROR = 437u32; +pub const ERROR_FILE_SNAP_UNEXPECTED_ERROR: WIN32_ERROR = 439u32; +pub const ERROR_FILE_SNAP_USER_SECTION_NOT_SUPPORTED: WIN32_ERROR = 436u32; +pub const ERROR_FILE_SYSTEM_LIMITATION: WIN32_ERROR = 665u32; +pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_BUSY: WIN32_ERROR = 371u32; +pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_INVALID_OPERATION: WIN32_ERROR = 385u32; +pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_METADATA_CORRUPT: WIN32_ERROR = 370u32; +pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_PROVIDER_UNKNOWN: WIN32_ERROR = 372u32; +pub const ERROR_FILE_SYSTEM_VIRTUALIZATION_UNAVAILABLE: WIN32_ERROR = 369u32; +pub const ERROR_FILE_TOO_LARGE: WIN32_ERROR = 223u32; +pub const ERROR_FIRMWARE_UPDATED: WIN32_ERROR = 728u32; +pub const ERROR_FLOAT_MULTIPLE_FAULTS: WIN32_ERROR = 630u32; +pub const ERROR_FLOAT_MULTIPLE_TRAPS: WIN32_ERROR = 631u32; +pub const ERROR_FLOPPY_BAD_REGISTERS: WIN32_ERROR = 1125u32; +pub const ERROR_FLOPPY_ID_MARK_NOT_FOUND: WIN32_ERROR = 1122u32; +pub const ERROR_FLOPPY_UNKNOWN_ERROR: WIN32_ERROR = 1124u32; +pub const ERROR_FLOPPY_VOLUME: WIN32_ERROR = 584u32; +pub const ERROR_FLOPPY_WRONG_CYLINDER: WIN32_ERROR = 1123u32; +pub const ERROR_FORMS_AUTH_REQUIRED: WIN32_ERROR = 224u32; +pub const ERROR_FOUND_OUT_OF_SCOPE: WIN32_ERROR = 601u32; +pub const ERROR_FSFILTER_OP_COMPLETED_SUCCESSFULLY: WIN32_ERROR = 762u32; +pub const ERROR_FS_DRIVER_REQUIRED: WIN32_ERROR = 588u32; +pub const ERROR_FS_METADATA_INCONSISTENT: WIN32_ERROR = 510u32; +pub const ERROR_FT_DI_SCAN_REQUIRED: WIN32_ERROR = 339u32; +pub const ERROR_FT_READ_FAILURE: WIN32_ERROR = 415u32; +pub const ERROR_FT_READ_FROM_COPY_FAILURE: WIN32_ERROR = 818u32; +pub const ERROR_FT_READ_RECOVERY_FROM_BACKUP: WIN32_ERROR = 704u32; +pub const ERROR_FT_WRITE_FAILURE: WIN32_ERROR = 338u32; +pub const ERROR_FT_WRITE_RECOVERY: WIN32_ERROR = 705u32; +pub const ERROR_FULLSCREEN_MODE: WIN32_ERROR = 1007u32; +pub const ERROR_FUNCTION_FAILED: WIN32_ERROR = 1627u32; +pub const ERROR_FUNCTION_NOT_CALLED: WIN32_ERROR = 1626u32; +pub const ERROR_GDI_HANDLE_LEAK: WIN32_ERROR = 373u32; +pub const ERROR_GENERIC_NOT_MAPPED: WIN32_ERROR = 1360u32; +pub const ERROR_GEN_FAILURE: WIN32_ERROR = 31u32; +pub const ERROR_GLOBAL_ONLY_HOOK: WIN32_ERROR = 1429u32; +pub const ERROR_GRACEFUL_DISCONNECT: WIN32_ERROR = 1226u32; +pub const ERROR_GROUP_EXISTS: WIN32_ERROR = 1318u32; +pub const ERROR_GUID_SUBSTITUTION_MADE: WIN32_ERROR = 680u32; +pub const ERROR_HANDLES_CLOSED: WIN32_ERROR = 676u32; +pub const ERROR_HANDLE_DISK_FULL: WIN32_ERROR = 39u32; +pub const ERROR_HANDLE_EOF: WIN32_ERROR = 38u32; +pub const ERROR_HANDLE_REVOKED: WIN32_ERROR = 811u32; +pub const ERROR_HAS_SYSTEM_CRITICAL_FILES: WIN32_ERROR = 488u32; +pub const ERROR_HIBERNATED: WIN32_ERROR = 726u32; +pub const ERROR_HIBERNATION_FAILURE: WIN32_ERROR = 656u32; +pub const ERROR_HOOK_NEEDS_HMOD: WIN32_ERROR = 1428u32; +pub const ERROR_HOOK_NOT_INSTALLED: WIN32_ERROR = 1431u32; +pub const ERROR_HOOK_TYPE_NOT_ALLOWED: WIN32_ERROR = 1458u32; +pub const ERROR_HOST_DOWN: WIN32_ERROR = 1256u32; +pub const ERROR_HOST_UNREACHABLE: WIN32_ERROR = 1232u32; +pub const ERROR_HOTKEY_ALREADY_REGISTERED: WIN32_ERROR = 1409u32; +pub const ERROR_HOTKEY_NOT_REGISTERED: WIN32_ERROR = 1419u32; +pub const ERROR_HWNDS_HAVE_DIFF_PARENT: WIN32_ERROR = 1441u32; +pub const ERROR_ILLEGAL_CHARACTER: WIN32_ERROR = 582u32; +pub const ERROR_ILLEGAL_DLL_RELOCATION: WIN32_ERROR = 623u32; +pub const ERROR_ILLEGAL_ELEMENT_ADDRESS: WIN32_ERROR = 1162u32; +pub const ERROR_ILLEGAL_FLOAT_CONTEXT: WIN32_ERROR = 579u32; +pub const ERROR_ILL_FORMED_PASSWORD: WIN32_ERROR = 1324u32; +pub const ERROR_IMAGE_AT_DIFFERENT_BASE: WIN32_ERROR = 807u32; +pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH: WIN32_ERROR = 706u32; +pub const ERROR_IMAGE_MACHINE_TYPE_MISMATCH_EXE: WIN32_ERROR = 720u32; +pub const ERROR_IMAGE_NOT_AT_BASE: WIN32_ERROR = 700u32; +pub const ERROR_IMAGE_SUBSYSTEM_NOT_PRESENT: WIN32_ERROR = 308u32; +pub const ERROR_IMPLEMENTATION_LIMIT: WIN32_ERROR = 1292u32; +pub const ERROR_INCOMPATIBLE_SERVICE_PRIVILEGE: WIN32_ERROR = 1297u32; +pub const ERROR_INCOMPATIBLE_SERVICE_SID_TYPE: WIN32_ERROR = 1290u32; +pub const ERROR_INCOMPATIBLE_WITH_GLOBAL_SHORT_NAME_REGISTRY_SETTING: WIN32_ERROR = 304u32; +pub const ERROR_INCORRECT_ACCOUNT_TYPE: WIN32_ERROR = 8646u32; +pub const ERROR_INCORRECT_ADDRESS: WIN32_ERROR = 1241u32; +pub const ERROR_INCORRECT_SIZE: WIN32_ERROR = 1462u32; +pub const ERROR_INDEX_ABSENT: WIN32_ERROR = 1611u32; +pub const ERROR_INDEX_OUT_OF_BOUNDS: WIN32_ERROR = 474u32; +pub const ERROR_INFLOOP_IN_RELOC_CHAIN: WIN32_ERROR = 202u32; +pub const ERROR_INSTALL_ALREADY_RUNNING: WIN32_ERROR = 1618u32; +pub const ERROR_INSTALL_FAILURE: WIN32_ERROR = 1603u32; +pub const ERROR_INSTALL_LANGUAGE_UNSUPPORTED: WIN32_ERROR = 1623u32; +pub const ERROR_INSTALL_LOG_FAILURE: WIN32_ERROR = 1622u32; +pub const ERROR_INSTALL_NOTUSED: WIN32_ERROR = 1634u32; +pub const ERROR_INSTALL_PACKAGE_INVALID: WIN32_ERROR = 1620u32; +pub const ERROR_INSTALL_PACKAGE_OPEN_FAILED: WIN32_ERROR = 1619u32; +pub const ERROR_INSTALL_PACKAGE_REJECTED: WIN32_ERROR = 1625u32; +pub const ERROR_INSTALL_PACKAGE_VERSION: WIN32_ERROR = 1613u32; +pub const ERROR_INSTALL_PLATFORM_UNSUPPORTED: WIN32_ERROR = 1633u32; +pub const ERROR_INSTALL_REJECTED: WIN32_ERROR = 1654u32; +pub const ERROR_INSTALL_REMOTE_DISALLOWED: WIN32_ERROR = 1640u32; +pub const ERROR_INSTALL_REMOTE_PROHIBITED: WIN32_ERROR = 1645u32; +pub const ERROR_INSTALL_SERVICE_FAILURE: WIN32_ERROR = 1601u32; +pub const ERROR_INSTALL_SERVICE_SAFEBOOT: WIN32_ERROR = 1652u32; +pub const ERROR_INSTALL_SOURCE_ABSENT: WIN32_ERROR = 1612u32; +pub const ERROR_INSTALL_SUSPEND: WIN32_ERROR = 1604u32; +pub const ERROR_INSTALL_TEMP_UNWRITABLE: WIN32_ERROR = 1632u32; +pub const ERROR_INSTALL_TRANSFORM_FAILURE: WIN32_ERROR = 1624u32; +pub const ERROR_INSTALL_TRANSFORM_REJECTED: WIN32_ERROR = 1644u32; +pub const ERROR_INSTALL_UI_FAILURE: WIN32_ERROR = 1621u32; +pub const ERROR_INSTALL_USEREXIT: WIN32_ERROR = 1602u32; +pub const ERROR_INSTRUCTION_MISALIGNMENT: WIN32_ERROR = 549u32; +pub const ERROR_INSUFFICIENT_BUFFER: WIN32_ERROR = 122u32; +pub const ERROR_INSUFFICIENT_LOGON_INFO: WIN32_ERROR = 608u32; +pub const ERROR_INSUFFICIENT_POWER: WIN32_ERROR = 639u32; +pub const ERROR_INSUFFICIENT_RESOURCE_FOR_SPECIFIED_SHARED_SECTION_SIZE: WIN32_ERROR = 781u32; +pub const ERROR_INSUFFICIENT_VIRTUAL_ADDR_RESOURCES: WIN32_ERROR = 473u32; +pub const ERROR_INTERMIXED_KERNEL_EA_OPERATION: WIN32_ERROR = 324u32; +pub const ERROR_INTERNAL_DB_CORRUPTION: WIN32_ERROR = 1358u32; +pub const ERROR_INTERNAL_DB_ERROR: WIN32_ERROR = 1383u32; +pub const ERROR_INTERNAL_ERROR: WIN32_ERROR = 1359u32; +pub const ERROR_INTERRUPT_STILL_CONNECTED: WIN32_ERROR = 764u32; +pub const ERROR_INTERRUPT_VECTOR_ALREADY_CONNECTED: WIN32_ERROR = 763u32; +pub const ERROR_INVALID_ACCEL_HANDLE: WIN32_ERROR = 1403u32; +pub const ERROR_INVALID_ACCESS: WIN32_ERROR = 12u32; +pub const ERROR_INVALID_ACCOUNT_NAME: WIN32_ERROR = 1315u32; +pub const ERROR_INVALID_ACE_CONDITION: WIN32_ERROR = 805u32; +pub const ERROR_INVALID_ACL: WIN32_ERROR = 1336u32; +pub const ERROR_INVALID_ADDRESS: WIN32_ERROR = 487u32; +pub const ERROR_INVALID_AT_INTERRUPT_TIME: WIN32_ERROR = 104u32; +pub const ERROR_INVALID_BLOCK: WIN32_ERROR = 9u32; +pub const ERROR_INVALID_BLOCK_LENGTH: WIN32_ERROR = 1106u32; +pub const ERROR_INVALID_CAP: WIN32_ERROR = 320u32; +pub const ERROR_INVALID_CATEGORY: WIN32_ERROR = 117u32; +pub const ERROR_INVALID_COMBOBOX_MESSAGE: WIN32_ERROR = 1422u32; +pub const ERROR_INVALID_COMMAND_LINE: WIN32_ERROR = 1639u32; +pub const ERROR_INVALID_COMPUTERNAME: WIN32_ERROR = 1210u32; +pub const ERROR_INVALID_CRUNTIME_PARAMETER: WIN32_ERROR = 1288u32; +pub const ERROR_INVALID_CURSOR_HANDLE: WIN32_ERROR = 1402u32; +pub const ERROR_INVALID_DATA: WIN32_ERROR = 13u32; +pub const ERROR_INVALID_DATATYPE: WIN32_ERROR = 1804u32; +pub const ERROR_INVALID_DEVICE_OBJECT_PARAMETER: WIN32_ERROR = 650u32; +pub const ERROR_INVALID_DLL: WIN32_ERROR = 1154u32; +pub const ERROR_INVALID_DOMAINNAME: WIN32_ERROR = 1212u32; +pub const ERROR_INVALID_DOMAIN_ROLE: WIN32_ERROR = 1354u32; +pub const ERROR_INVALID_DOMAIN_STATE: WIN32_ERROR = 1353u32; +pub const ERROR_INVALID_DRIVE: WIN32_ERROR = 15u32; +pub const ERROR_INVALID_DWP_HANDLE: WIN32_ERROR = 1405u32; +pub const ERROR_INVALID_EA_HANDLE: WIN32_ERROR = 278u32; +pub const ERROR_INVALID_EA_NAME: WIN32_ERROR = 254u32; +pub const ERROR_INVALID_EDIT_HEIGHT: WIN32_ERROR = 1424u32; +pub const ERROR_INVALID_ENVIRONMENT: WIN32_ERROR = 1805u32; +pub const ERROR_INVALID_EVENTNAME: WIN32_ERROR = 1211u32; +pub const ERROR_INVALID_EVENT_COUNT: WIN32_ERROR = 151u32; +pub const ERROR_INVALID_EXCEPTION_HANDLER: WIN32_ERROR = 310u32; +pub const ERROR_INVALID_EXE_SIGNATURE: WIN32_ERROR = 191u32; +pub const ERROR_INVALID_FIELD: WIN32_ERROR = 1616u32; +pub const ERROR_INVALID_FIELD_IN_PARAMETER_LIST: WIN32_ERROR = 328u32; +pub const ERROR_INVALID_FILTER_PROC: WIN32_ERROR = 1427u32; +pub const ERROR_INVALID_FLAGS: WIN32_ERROR = 1004u32; +pub const ERROR_INVALID_FLAG_NUMBER: WIN32_ERROR = 186u32; +pub const ERROR_INVALID_FORM_NAME: WIN32_ERROR = 1902u32; +pub const ERROR_INVALID_FORM_SIZE: WIN32_ERROR = 1903u32; +pub const ERROR_INVALID_FUNCTION: WIN32_ERROR = 1u32; +pub const ERROR_INVALID_GROUPNAME: WIN32_ERROR = 1209u32; +pub const ERROR_INVALID_GROUP_ATTRIBUTES: WIN32_ERROR = 1345u32; +pub const ERROR_INVALID_GW_COMMAND: WIN32_ERROR = 1443u32; +pub const ERROR_INVALID_HANDLE: WIN32_ERROR = 6u32; +pub const ERROR_INVALID_HANDLE_STATE: WIN32_ERROR = 1609u32; +pub const ERROR_INVALID_HOOK_FILTER: WIN32_ERROR = 1426u32; +pub const ERROR_INVALID_HOOK_HANDLE: WIN32_ERROR = 1404u32; +pub const ERROR_INVALID_HW_PROFILE: WIN32_ERROR = 619u32; +pub const ERROR_INVALID_ICON_HANDLE: WIN32_ERROR = 1414u32; +pub const ERROR_INVALID_ID_AUTHORITY: WIN32_ERROR = 1343u32; +pub const ERROR_INVALID_IMAGE_HASH: WIN32_ERROR = 577u32; +pub const ERROR_INVALID_IMPORT_OF_NON_DLL: WIN32_ERROR = 1276u32; +pub const ERROR_INVALID_INDEX: WIN32_ERROR = 1413u32; +pub const ERROR_INVALID_KERNEL_INFO_VERSION: WIN32_ERROR = 340u32; +pub const ERROR_INVALID_KEYBOARD_HANDLE: WIN32_ERROR = 1457u32; +pub const ERROR_INVALID_LABEL: WIN32_ERROR = 1299u32; +pub const ERROR_INVALID_LB_MESSAGE: WIN32_ERROR = 1432u32; +pub const ERROR_INVALID_LDT_DESCRIPTOR: WIN32_ERROR = 564u32; +pub const ERROR_INVALID_LDT_OFFSET: WIN32_ERROR = 563u32; +pub const ERROR_INVALID_LDT_SIZE: WIN32_ERROR = 561u32; +pub const ERROR_INVALID_LEVEL: WIN32_ERROR = 124u32; +pub const ERROR_INVALID_LIST_FORMAT: WIN32_ERROR = 153u32; +pub const ERROR_INVALID_LOCK_RANGE: WIN32_ERROR = 307u32; +pub const ERROR_INVALID_LOGON_HOURS: WIN32_ERROR = 1328u32; +pub const ERROR_INVALID_LOGON_TYPE: WIN32_ERROR = 1367u32; +pub const ERROR_INVALID_MEMBER: WIN32_ERROR = 1388u32; +pub const ERROR_INVALID_MENU_HANDLE: WIN32_ERROR = 1401u32; +pub const ERROR_INVALID_MESSAGE: WIN32_ERROR = 1002u32; +pub const ERROR_INVALID_MESSAGEDEST: WIN32_ERROR = 1218u32; +pub const ERROR_INVALID_MESSAGENAME: WIN32_ERROR = 1217u32; +pub const ERROR_INVALID_MINALLOCSIZE: WIN32_ERROR = 195u32; +pub const ERROR_INVALID_MODULETYPE: WIN32_ERROR = 190u32; +pub const ERROR_INVALID_MONITOR_HANDLE: WIN32_ERROR = 1461u32; +pub const ERROR_INVALID_MSGBOX_STYLE: WIN32_ERROR = 1438u32; +pub const ERROR_INVALID_NAME: WIN32_ERROR = 123u32; +pub const ERROR_INVALID_NETNAME: WIN32_ERROR = 1214u32; +pub const ERROR_INVALID_OPLOCK_PROTOCOL: WIN32_ERROR = 301u32; +pub const ERROR_INVALID_ORDINAL: WIN32_ERROR = 182u32; +pub const ERROR_INVALID_OWNER: WIN32_ERROR = 1307u32; +pub const ERROR_INVALID_PACKAGE_SID_LENGTH: WIN32_ERROR = 4253u32; +pub const ERROR_INVALID_PARAMETER: WIN32_ERROR = 87u32; +pub const ERROR_INVALID_PASSWORD: WIN32_ERROR = 86u32; +pub const ERROR_INVALID_PASSWORDNAME: WIN32_ERROR = 1216u32; +pub const ERROR_INVALID_PATCH_XML: WIN32_ERROR = 1650u32; +pub const ERROR_INVALID_PEP_INFO_VERSION: WIN32_ERROR = 341u32; +pub const ERROR_INVALID_PLUGPLAY_DEVICE_PATH: WIN32_ERROR = 620u32; +pub const ERROR_INVALID_PORT_ATTRIBUTES: WIN32_ERROR = 545u32; +pub const ERROR_INVALID_PRIMARY_GROUP: WIN32_ERROR = 1308u32; +pub const ERROR_INVALID_PRINTER_COMMAND: WIN32_ERROR = 1803u32; +pub const ERROR_INVALID_PRINTER_NAME: WIN32_ERROR = 1801u32; +pub const ERROR_INVALID_PRINTER_STATE: WIN32_ERROR = 1906u32; +pub const ERROR_INVALID_PRIORITY: WIN32_ERROR = 1800u32; +pub const ERROR_INVALID_QUOTA_LOWER: WIN32_ERROR = 547u32; +pub const ERROR_INVALID_REPARSE_DATA: WIN32_ERROR = 4392u32; +pub const ERROR_INVALID_SCROLLBAR_RANGE: WIN32_ERROR = 1448u32; +pub const ERROR_INVALID_SECURITY_DESCR: WIN32_ERROR = 1338u32; +pub const ERROR_INVALID_SEGDPL: WIN32_ERROR = 198u32; +pub const ERROR_INVALID_SEGMENT_NUMBER: WIN32_ERROR = 180u32; +pub const ERROR_INVALID_SEPARATOR_FILE: WIN32_ERROR = 1799u32; +pub const ERROR_INVALID_SERVER_STATE: WIN32_ERROR = 1352u32; +pub const ERROR_INVALID_SERVICENAME: WIN32_ERROR = 1213u32; +pub const ERROR_INVALID_SERVICE_ACCOUNT: WIN32_ERROR = 1057u32; +pub const ERROR_INVALID_SERVICE_CONTROL: WIN32_ERROR = 1052u32; +pub const ERROR_INVALID_SERVICE_LOCK: WIN32_ERROR = 1071u32; +pub const ERROR_INVALID_SHARENAME: WIN32_ERROR = 1215u32; +pub const ERROR_INVALID_SHOWWIN_COMMAND: WIN32_ERROR = 1449u32; +pub const ERROR_INVALID_SID: WIN32_ERROR = 1337u32; +pub const ERROR_INVALID_SIGNAL_NUMBER: WIN32_ERROR = 209u32; +pub const ERROR_INVALID_SPI_VALUE: WIN32_ERROR = 1439u32; +pub const ERROR_INVALID_STACKSEG: WIN32_ERROR = 189u32; +pub const ERROR_INVALID_STARTING_CODESEG: WIN32_ERROR = 188u32; +pub const ERROR_INVALID_SUB_AUTHORITY: WIN32_ERROR = 1335u32; +pub const ERROR_INVALID_TABLE: WIN32_ERROR = 1628u32; +pub const ERROR_INVALID_TARGET_HANDLE: WIN32_ERROR = 114u32; +pub const ERROR_INVALID_TASK_INDEX: WIN32_ERROR = 1551u32; +pub const ERROR_INVALID_TASK_NAME: WIN32_ERROR = 1550u32; +pub const ERROR_INVALID_THREAD_ID: WIN32_ERROR = 1444u32; +pub const ERROR_INVALID_TIME: WIN32_ERROR = 1901u32; +pub const ERROR_INVALID_TOKEN: WIN32_ERROR = 315u32; +pub const ERROR_INVALID_UNWIND_TARGET: WIN32_ERROR = 544u32; +pub const ERROR_INVALID_USER_BUFFER: WIN32_ERROR = 1784u32; +pub const ERROR_INVALID_USER_PRINCIPAL_NAME: WIN32_ERROR = 8636u32; +pub const ERROR_INVALID_VARIANT: WIN32_ERROR = 604u32; +pub const ERROR_INVALID_VERIFY_SWITCH: WIN32_ERROR = 118u32; +pub const ERROR_INVALID_WINDOW_HANDLE: WIN32_ERROR = 1400u32; +pub const ERROR_INVALID_WORKSTATION: WIN32_ERROR = 1329u32; +pub const ERROR_IOPL_NOT_ENABLED: WIN32_ERROR = 197u32; +pub const ERROR_IO_DEVICE: WIN32_ERROR = 1117u32; +pub const ERROR_IO_INCOMPLETE: WIN32_ERROR = 996u32; +pub const ERROR_IO_PENDING: WIN32_ERROR = 997u32; +pub const ERROR_IO_PRIVILEGE_FAILED: WIN32_ERROR = 571u32; +pub const ERROR_IO_REISSUE_AS_CACHED: WIN32_ERROR = 3950u32; +pub const ERROR_IPSEC_IKE_TIMED_OUT: WIN32_ERROR = 13805u32; +pub const ERROR_IP_ADDRESS_CONFLICT1: WIN32_ERROR = 611u32; +pub const ERROR_IP_ADDRESS_CONFLICT2: WIN32_ERROR = 612u32; +pub const ERROR_IRQ_BUSY: WIN32_ERROR = 1119u32; +pub const ERROR_IS_JOINED: WIN32_ERROR = 134u32; +pub const ERROR_IS_JOIN_PATH: WIN32_ERROR = 147u32; +pub const ERROR_IS_JOIN_TARGET: WIN32_ERROR = 133u32; +pub const ERROR_IS_SUBSTED: WIN32_ERROR = 135u32; +pub const ERROR_IS_SUBST_PATH: WIN32_ERROR = 146u32; +pub const ERROR_IS_SUBST_TARGET: WIN32_ERROR = 149u32; +pub const ERROR_ITERATED_DATA_EXCEEDS_64k: WIN32_ERROR = 194u32; +pub const ERROR_JOB_NO_CONTAINER: WIN32_ERROR = 1505u32; +pub const ERROR_JOIN_TO_JOIN: WIN32_ERROR = 138u32; +pub const ERROR_JOIN_TO_SUBST: WIN32_ERROR = 140u32; +pub const ERROR_JOURNAL_DELETE_IN_PROGRESS: WIN32_ERROR = 1178u32; +pub const ERROR_JOURNAL_ENTRY_DELETED: WIN32_ERROR = 1181u32; +pub const ERROR_JOURNAL_HOOK_SET: WIN32_ERROR = 1430u32; +pub const ERROR_JOURNAL_NOT_ACTIVE: WIN32_ERROR = 1179u32; +pub const ERROR_KERNEL_APC: WIN32_ERROR = 738u32; +pub const ERROR_KEY_DELETED: WIN32_ERROR = 1018u32; +pub const ERROR_KEY_HAS_CHILDREN: WIN32_ERROR = 1020u32; +pub const ERROR_KM_DRIVER_BLOCKED: WIN32_ERROR = 1930u32; +pub const ERROR_LABEL_TOO_LONG: WIN32_ERROR = 154u32; +pub const ERROR_LAST_ADMIN: WIN32_ERROR = 1322u32; +pub const ERROR_LB_WITHOUT_TABSTOPS: WIN32_ERROR = 1434u32; +pub const ERROR_LICENSE_QUOTA_EXCEEDED: WIN32_ERROR = 1395u32; +pub const ERROR_LINUX_SUBSYSTEM_NOT_PRESENT: WIN32_ERROR = 414u32; +pub const ERROR_LINUX_SUBSYSTEM_UPDATE_REQUIRED: WIN32_ERROR = 444u32; +pub const ERROR_LISTBOX_ID_NOT_FOUND: WIN32_ERROR = 1416u32; +pub const ERROR_LM_CROSS_ENCRYPTION_REQUIRED: WIN32_ERROR = 1390u32; +pub const ERROR_LOCAL_POLICY_MODIFICATION_NOT_SUPPORTED: WIN32_ERROR = 8653u32; +pub const ERROR_LOCAL_USER_SESSION_KEY: WIN32_ERROR = 1303u32; +pub const ERROR_LOCKED: WIN32_ERROR = 212u32; +pub const ERROR_LOCK_FAILED: WIN32_ERROR = 167u32; +pub const ERROR_LOCK_VIOLATION: WIN32_ERROR = 33u32; +pub const ERROR_LOGIN_TIME_RESTRICTION: WIN32_ERROR = 1239u32; +pub const ERROR_LOGIN_WKSTA_RESTRICTION: WIN32_ERROR = 1240u32; +pub const ERROR_LOGON_FAILURE: WIN32_ERROR = 1326u32; +pub const ERROR_LOGON_NOT_GRANTED: WIN32_ERROR = 1380u32; +pub const ERROR_LOGON_SERVER_CONFLICT: WIN32_ERROR = 568u32; +pub const ERROR_LOGON_SESSION_COLLISION: WIN32_ERROR = 1366u32; +pub const ERROR_LOGON_SESSION_EXISTS: WIN32_ERROR = 1363u32; +pub const ERROR_LOGON_TYPE_NOT_GRANTED: WIN32_ERROR = 1385u32; +pub const ERROR_LOG_FILE_FULL: WIN32_ERROR = 1502u32; +pub const ERROR_LOG_HARD_ERROR: WIN32_ERROR = 718u32; +pub const ERROR_LONGJUMP: WIN32_ERROR = 682u32; +pub const ERROR_LOST_MODE_LOGON_RESTRICTION: WIN32_ERROR = 1939u32; +pub const ERROR_LOST_WRITEBEHIND_DATA: WIN32_ERROR = 596u32; +pub const ERROR_LOST_WRITEBEHIND_DATA_LOCAL_DISK_ERROR: WIN32_ERROR = 790u32; +pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_DISCONNECTED: WIN32_ERROR = 788u32; +pub const ERROR_LOST_WRITEBEHIND_DATA_NETWORK_SERVER_ERROR: WIN32_ERROR = 789u32; +pub const ERROR_LUIDS_EXHAUSTED: WIN32_ERROR = 1334u32; +pub const ERROR_MACHINE_LOCKED: WIN32_ERROR = 1271u32; +pub const ERROR_MAGAZINE_NOT_PRESENT: WIN32_ERROR = 1163u32; +pub const ERROR_MAPPED_ALIGNMENT: WIN32_ERROR = 1132u32; +pub const ERROR_MARKED_TO_DISALLOW_WRITES: WIN32_ERROR = 348u32; +pub const ERROR_MARSHALL_OVERFLOW: WIN32_ERROR = 603u32; +pub const ERROR_MAX_SESSIONS_REACHED: WIN32_ERROR = 353u32; +pub const ERROR_MAX_THRDS_REACHED: WIN32_ERROR = 164u32; +pub const ERROR_MCA_EXCEPTION: WIN32_ERROR = 784u32; +pub const ERROR_MCA_OCCURED: WIN32_ERROR = 651u32; +pub const ERROR_MEDIA_CHANGED: WIN32_ERROR = 1110u32; +pub const ERROR_MEDIA_CHECK: WIN32_ERROR = 679u32; +pub const ERROR_MEMBERS_PRIMARY_GROUP: WIN32_ERROR = 1374u32; +pub const ERROR_MEMBER_IN_ALIAS: WIN32_ERROR = 1378u32; +pub const ERROR_MEMBER_IN_GROUP: WIN32_ERROR = 1320u32; +pub const ERROR_MEMBER_NOT_IN_ALIAS: WIN32_ERROR = 1377u32; +pub const ERROR_MEMBER_NOT_IN_GROUP: WIN32_ERROR = 1321u32; +pub const ERROR_MEMORY_HARDWARE: WIN32_ERROR = 779u32; +pub const ERROR_MENU_ITEM_NOT_FOUND: WIN32_ERROR = 1456u32; +pub const ERROR_MESSAGE_SYNC_ONLY: WIN32_ERROR = 1159u32; +pub const ERROR_META_EXPANSION_TOO_LONG: WIN32_ERROR = 208u32; +pub const ERROR_MISSING_SYSTEMFILE: WIN32_ERROR = 573u32; +pub const ERROR_MOD_NOT_FOUND: WIN32_ERROR = 126u32; +pub const ERROR_MORE_DATA: WIN32_ERROR = 234u32; +pub const ERROR_MORE_WRITES: WIN32_ERROR = 1120u32; +pub const ERROR_MOUNT_POINT_NOT_RESOLVED: WIN32_ERROR = 649u32; +pub const ERROR_MP_PROCESSOR_MISMATCH: WIN32_ERROR = 725u32; +pub const ERROR_MR_MID_NOT_FOUND: WIN32_ERROR = 317u32; +pub const ERROR_MULTIPLE_FAULT_VIOLATION: WIN32_ERROR = 640u32; +pub const ERROR_MUTANT_LIMIT_EXCEEDED: WIN32_ERROR = 587u32; +pub const ERROR_MUTUAL_AUTH_FAILED: WIN32_ERROR = 1397u32; +pub const ERROR_NEGATIVE_SEEK: WIN32_ERROR = 131u32; +pub const ERROR_NESTING_NOT_ALLOWED: WIN32_ERROR = 215u32; +pub const ERROR_NETLOGON_NOT_STARTED: WIN32_ERROR = 1792u32; +pub const ERROR_NETNAME_DELETED: WIN32_ERROR = 64u32; +pub const ERROR_NETWORK_ACCESS_DENIED: WIN32_ERROR = 65u32; +pub const ERROR_NETWORK_ACCESS_DENIED_EDP: WIN32_ERROR = 354u32; +pub const ERROR_NETWORK_BUSY: WIN32_ERROR = 54u32; +pub const ERROR_NETWORK_UNREACHABLE: WIN32_ERROR = 1231u32; +pub const ERROR_NET_OPEN_FAILED: WIN32_ERROR = 570u32; +pub const ERROR_NET_WRITE_FAULT: WIN32_ERROR = 88u32; +pub const ERROR_NOACCESS: WIN32_ERROR = 998u32; +pub const ERROR_NOINTERFACE: WIN32_ERROR = 632u32; +pub const ERROR_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT: WIN32_ERROR = 1807u32; +pub const ERROR_NOLOGON_SERVER_TRUST_ACCOUNT: WIN32_ERROR = 1809u32; +pub const ERROR_NOLOGON_WORKSTATION_TRUST_ACCOUNT: WIN32_ERROR = 1808u32; +pub const ERROR_NONE_MAPPED: WIN32_ERROR = 1332u32; +pub const ERROR_NONPAGED_SYSTEM_RESOURCES: WIN32_ERROR = 1451u32; +pub const ERROR_NON_ACCOUNT_SID: WIN32_ERROR = 1257u32; +pub const ERROR_NON_DOMAIN_SID: WIN32_ERROR = 1258u32; +pub const ERROR_NON_MDICHILD_WINDOW: WIN32_ERROR = 1445u32; +pub const ERROR_NOTHING_TO_TERMINATE: WIN32_ERROR = 758u32; +pub const ERROR_NOTIFICATION_GUID_ALREADY_DEFINED: WIN32_ERROR = 309u32; +pub const ERROR_NOTIFY_CLEANUP: WIN32_ERROR = 745u32; +pub const ERROR_NOTIFY_ENUM_DIR: WIN32_ERROR = 1022u32; +pub const ERROR_NOT_ALLOWED_ON_SYSTEM_FILE: WIN32_ERROR = 313u32; +pub const ERROR_NOT_ALL_ASSIGNED: WIN32_ERROR = 1300u32; +pub const ERROR_NOT_APPCONTAINER: WIN32_ERROR = 4250u32; +pub const ERROR_NOT_AUTHENTICATED: WIN32_ERROR = 1244u32; +pub const ERROR_NOT_A_CLOUD_FILE: WIN32_ERROR = 376u32; +pub const ERROR_NOT_A_CLOUD_SYNC_ROOT: WIN32_ERROR = 405u32; +pub const ERROR_NOT_A_DAX_VOLUME: WIN32_ERROR = 420u32; +pub const ERROR_NOT_A_REPARSE_POINT: WIN32_ERROR = 4390u32; +pub const ERROR_NOT_CAPABLE: WIN32_ERROR = 775u32; +pub const ERROR_NOT_CHILD_WINDOW: WIN32_ERROR = 1442u32; +pub const ERROR_NOT_CONNECTED: WIN32_ERROR = 2250u32; +pub const ERROR_NOT_CONTAINER: WIN32_ERROR = 1207u32; +pub const ERROR_NOT_DAX_MAPPABLE: WIN32_ERROR = 421u32; +pub const ERROR_NOT_DOS_DISK: WIN32_ERROR = 26u32; +pub const ERROR_NOT_ENOUGH_MEMORY: WIN32_ERROR = 8u32; +pub const ERROR_NOT_ENOUGH_QUOTA: WIN32_ERROR = 1816u32; +pub const ERROR_NOT_ENOUGH_SERVER_MEMORY: WIN32_ERROR = 1130u32; +pub const ERROR_NOT_EXPORT_FORMAT: WIN32_ERROR = 6008u32; +pub const ERROR_NOT_FOUND: WIN32_ERROR = 1168u32; +pub const ERROR_NOT_GUI_PROCESS: WIN32_ERROR = 1471u32; +pub const ERROR_NOT_JOINED: WIN32_ERROR = 136u32; +pub const ERROR_NOT_LOCKED: WIN32_ERROR = 158u32; +pub const ERROR_NOT_LOGGED_ON: WIN32_ERROR = 1245u32; +pub const ERROR_NOT_LOGON_PROCESS: WIN32_ERROR = 1362u32; +pub const ERROR_NOT_OWNER: WIN32_ERROR = 288u32; +pub const ERROR_NOT_READY: WIN32_ERROR = 21u32; +pub const ERROR_NOT_READ_FROM_COPY: WIN32_ERROR = 337u32; +pub const ERROR_NOT_REDUNDANT_STORAGE: WIN32_ERROR = 333u32; +pub const ERROR_NOT_REGISTRY_FILE: WIN32_ERROR = 1017u32; +pub const ERROR_NOT_SAFEBOOT_SERVICE: WIN32_ERROR = 1084u32; +pub const ERROR_NOT_SAFE_MODE_DRIVER: WIN32_ERROR = 646u32; +pub const ERROR_NOT_SAME_DEVICE: WIN32_ERROR = 17u32; +pub const ERROR_NOT_SAME_OBJECT: WIN32_ERROR = 1656u32; +pub const ERROR_NOT_SUBSTED: WIN32_ERROR = 137u32; +pub const ERROR_NOT_SUPPORTED: WIN32_ERROR = 50u32; +pub const ERROR_NOT_SUPPORTED_IN_APPCONTAINER: WIN32_ERROR = 4252u32; +pub const ERROR_NOT_SUPPORTED_ON_DAX: WIN32_ERROR = 360u32; +pub const ERROR_NOT_SUPPORTED_ON_SBS: WIN32_ERROR = 1254u32; +pub const ERROR_NOT_SUPPORTED_ON_STANDARD_SERVER: WIN32_ERROR = 8584u32; +pub const ERROR_NOT_SUPPORTED_WITH_AUDITING: WIN32_ERROR = 499u32; +pub const ERROR_NOT_SUPPORTED_WITH_BTT: WIN32_ERROR = 429u32; +pub const ERROR_NOT_SUPPORTED_WITH_BYPASSIO: WIN32_ERROR = 493u32; +pub const ERROR_NOT_SUPPORTED_WITH_CACHED_HANDLE: WIN32_ERROR = 509u32; +pub const ERROR_NOT_SUPPORTED_WITH_COMPRESSION: WIN32_ERROR = 496u32; +pub const ERROR_NOT_SUPPORTED_WITH_DEDUPLICATION: WIN32_ERROR = 498u32; +pub const ERROR_NOT_SUPPORTED_WITH_ENCRYPTION: WIN32_ERROR = 495u32; +pub const ERROR_NOT_SUPPORTED_WITH_MONITORING: WIN32_ERROR = 503u32; +pub const ERROR_NOT_SUPPORTED_WITH_REPLICATION: WIN32_ERROR = 497u32; +pub const ERROR_NOT_SUPPORTED_WITH_SNAPSHOT: WIN32_ERROR = 504u32; +pub const ERROR_NOT_SUPPORTED_WITH_VIRTUALIZATION: WIN32_ERROR = 505u32; +pub const ERROR_NOT_TINY_STREAM: WIN32_ERROR = 598u32; +pub const ERROR_NO_ACE_CONDITION: WIN32_ERROR = 804u32; +pub const ERROR_NO_ASSOCIATION: WIN32_ERROR = 1155u32; +pub const ERROR_NO_BYPASSIO_DRIVER_SUPPORT: WIN32_ERROR = 494u32; +pub const ERROR_NO_CALLBACK_ACTIVE: WIN32_ERROR = 614u32; +pub const ERROR_NO_DATA: WIN32_ERROR = 232u32; +pub const ERROR_NO_DATA_DETECTED: WIN32_ERROR = 1104u32; +pub const ERROR_NO_EFS: WIN32_ERROR = 6004u32; +pub const ERROR_NO_EVENT_PAIR: WIN32_ERROR = 580u32; +pub const ERROR_NO_GUID_TRANSLATION: WIN32_ERROR = 560u32; +pub const ERROR_NO_IMPERSONATION_TOKEN: WIN32_ERROR = 1309u32; +pub const ERROR_NO_INHERITANCE: WIN32_ERROR = 1391u32; +pub const ERROR_NO_LOGON_SERVERS: WIN32_ERROR = 1311u32; +pub const ERROR_NO_LOG_SPACE: WIN32_ERROR = 1019u32; +pub const ERROR_NO_MATCH: WIN32_ERROR = 1169u32; +pub const ERROR_NO_MEDIA_IN_DRIVE: WIN32_ERROR = 1112u32; +pub const ERROR_NO_MORE_DEVICES: WIN32_ERROR = 1248u32; +pub const ERROR_NO_MORE_FILES: WIN32_ERROR = 18u32; +pub const ERROR_NO_MORE_ITEMS: WIN32_ERROR = 259u32; +pub const ERROR_NO_MORE_MATCHES: WIN32_ERROR = 626u32; +pub const ERROR_NO_MORE_SEARCH_HANDLES: WIN32_ERROR = 113u32; +pub const ERROR_NO_MORE_USER_HANDLES: WIN32_ERROR = 1158u32; +pub const ERROR_NO_NETWORK: WIN32_ERROR = 1222u32; +pub const ERROR_NO_NET_OR_BAD_PATH: WIN32_ERROR = 1203u32; +pub const ERROR_NO_NVRAM_RESOURCES: WIN32_ERROR = 1470u32; +pub const ERROR_NO_PAGEFILE: WIN32_ERROR = 578u32; +pub const ERROR_NO_PHYSICALLY_ALIGNED_FREE_SPACE_FOUND: WIN32_ERROR = 408u32; +pub const ERROR_NO_PROC_SLOTS: WIN32_ERROR = 89u32; +pub const ERROR_NO_PROMOTION_ACTIVE: WIN32_ERROR = 8222u32; +pub const ERROR_NO_QUOTAS_FOR_ACCOUNT: WIN32_ERROR = 1302u32; +pub const ERROR_NO_RANGES_PROCESSED: WIN32_ERROR = 312u32; +pub const ERROR_NO_RECOVERY_POLICY: WIN32_ERROR = 6003u32; +pub const ERROR_NO_RECOVERY_PROGRAM: WIN32_ERROR = 1082u32; +pub const ERROR_NO_SCROLLBARS: WIN32_ERROR = 1447u32; +pub const ERROR_NO_SECRETS: WIN32_ERROR = 8620u32; +pub const ERROR_NO_SECURITY_ON_OBJECT: WIN32_ERROR = 1350u32; +pub const ERROR_NO_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1116u32; +pub const ERROR_NO_SIGNAL_SENT: WIN32_ERROR = 205u32; +pub const ERROR_NO_SITENAME: WIN32_ERROR = 1919u32; +pub const ERROR_NO_SITE_SETTINGS_OBJECT: WIN32_ERROR = 8619u32; +pub const ERROR_NO_SPOOL_SPACE: WIN32_ERROR = 62u32; +pub const ERROR_NO_SUCH_ALIAS: WIN32_ERROR = 1376u32; +pub const ERROR_NO_SUCH_DEVICE: WIN32_ERROR = 433u32; +pub const ERROR_NO_SUCH_DOMAIN: WIN32_ERROR = 1355u32; +pub const ERROR_NO_SUCH_GROUP: WIN32_ERROR = 1319u32; +pub const ERROR_NO_SUCH_LOGON_SESSION: WIN32_ERROR = 1312u32; +pub const ERROR_NO_SUCH_MEMBER: WIN32_ERROR = 1387u32; +pub const ERROR_NO_SUCH_PACKAGE: WIN32_ERROR = 1364u32; +pub const ERROR_NO_SUCH_PRIVILEGE: WIN32_ERROR = 1313u32; +pub const ERROR_NO_SUCH_SITE: WIN32_ERROR = 1249u32; +pub const ERROR_NO_SUCH_USER: WIN32_ERROR = 1317u32; +pub const ERROR_NO_SYSTEM_MENU: WIN32_ERROR = 1437u32; +pub const ERROR_NO_SYSTEM_RESOURCES: WIN32_ERROR = 1450u32; +pub const ERROR_NO_TASK_QUEUE: WIN32_ERROR = 427u32; +pub const ERROR_NO_TOKEN: WIN32_ERROR = 1008u32; +pub const ERROR_NO_TRACKING_SERVICE: WIN32_ERROR = 1172u32; +pub const ERROR_NO_TRUST_LSA_SECRET: WIN32_ERROR = 1786u32; +pub const ERROR_NO_TRUST_SAM_ACCOUNT: WIN32_ERROR = 1787u32; +pub const ERROR_NO_UNICODE_TRANSLATION: WIN32_ERROR = 1113u32; +pub const ERROR_NO_USER_KEYS: WIN32_ERROR = 6006u32; +pub const ERROR_NO_USER_SESSION_KEY: WIN32_ERROR = 1394u32; +pub const ERROR_NO_VOLUME_ID: WIN32_ERROR = 1173u32; +pub const ERROR_NO_VOLUME_LABEL: WIN32_ERROR = 125u32; +pub const ERROR_NO_WILDCARD_CHARACTERS: WIN32_ERROR = 1417u32; +pub const ERROR_NO_WORK_DONE: WIN32_ERROR = 235u32; +pub const ERROR_NO_WRITABLE_DC_FOUND: WIN32_ERROR = 8621u32; +pub const ERROR_NO_YIELD_PERFORMED: WIN32_ERROR = 721u32; +pub const ERROR_NTLM_BLOCKED: WIN32_ERROR = 1937u32; +pub const ERROR_NT_CROSS_ENCRYPTION_REQUIRED: WIN32_ERROR = 1386u32; +pub const ERROR_NULL_LM_PASSWORD: WIN32_ERROR = 1304u32; +pub const ERROR_OBJECT_IS_IMMUTABLE: WIN32_ERROR = 4449u32; +pub const ERROR_OBJECT_NAME_EXISTS: WIN32_ERROR = 698u32; +pub const ERROR_OBJECT_NOT_EXTERNALLY_BACKED: WIN32_ERROR = 342u32; +pub const ERROR_OFFLOAD_READ_FILE_NOT_SUPPORTED: WIN32_ERROR = 4442u32; +pub const ERROR_OFFLOAD_READ_FLT_NOT_SUPPORTED: WIN32_ERROR = 4440u32; +pub const ERROR_OFFLOAD_WRITE_FILE_NOT_SUPPORTED: WIN32_ERROR = 4443u32; +pub const ERROR_OFFLOAD_WRITE_FLT_NOT_SUPPORTED: WIN32_ERROR = 4441u32; +pub const ERROR_OFFSET_ALIGNMENT_VIOLATION: WIN32_ERROR = 327u32; +pub const ERROR_OLD_WIN_VERSION: WIN32_ERROR = 1150u32; +pub const ERROR_ONLY_IF_CONNECTED: WIN32_ERROR = 1251u32; +pub const ERROR_OPEN_FAILED: WIN32_ERROR = 110u32; +pub const ERROR_OPEN_FILES: WIN32_ERROR = 2401u32; +pub const ERROR_OPERATION_ABORTED: WIN32_ERROR = 995u32; +pub const ERROR_OPERATION_IN_PROGRESS: WIN32_ERROR = 329u32; +pub const ERROR_OPLOCK_BREAK_IN_PROGRESS: WIN32_ERROR = 742u32; +pub const ERROR_OPLOCK_HANDLE_CLOSED: WIN32_ERROR = 803u32; +pub const ERROR_OPLOCK_NOT_GRANTED: WIN32_ERROR = 300u32; +pub const ERROR_OPLOCK_SWITCHED_TO_NEW_HANDLE: WIN32_ERROR = 800u32; +pub const ERROR_ORPHAN_NAME_EXHAUSTED: WIN32_ERROR = 799u32; +pub const ERROR_OUTOFMEMORY: WIN32_ERROR = 14u32; +pub const ERROR_OUT_OF_PAPER: WIN32_ERROR = 28u32; +pub const ERROR_OUT_OF_STRUCTURES: WIN32_ERROR = 84u32; +pub const ERROR_OVERRIDE_NOCHANGES: WIN32_ERROR = 1252u32; +pub const ERROR_PAGED_SYSTEM_RESOURCES: WIN32_ERROR = 1452u32; +pub const ERROR_PAGEFILE_CREATE_FAILED: WIN32_ERROR = 576u32; +pub const ERROR_PAGEFILE_NOT_SUPPORTED: WIN32_ERROR = 491u32; +pub const ERROR_PAGEFILE_QUOTA: WIN32_ERROR = 1454u32; +pub const ERROR_PAGEFILE_QUOTA_EXCEEDED: WIN32_ERROR = 567u32; +pub const ERROR_PAGE_FAULT_COPY_ON_WRITE: WIN32_ERROR = 749u32; +pub const ERROR_PAGE_FAULT_DEMAND_ZERO: WIN32_ERROR = 748u32; +pub const ERROR_PAGE_FAULT_GUARD_PAGE: WIN32_ERROR = 750u32; +pub const ERROR_PAGE_FAULT_PAGING_FILE: WIN32_ERROR = 751u32; +pub const ERROR_PAGE_FAULT_TRANSITION: WIN32_ERROR = 747u32; +pub const ERROR_PARAMETER_QUOTA_EXCEEDED: WIN32_ERROR = 1283u32; +pub const ERROR_PARTIAL_COPY: WIN32_ERROR = 299u32; +pub const ERROR_PARTITION_FAILURE: WIN32_ERROR = 1105u32; +pub const ERROR_PARTITION_TERMINATING: WIN32_ERROR = 1184u32; +pub const ERROR_PASSWORD_CHANGE_REQUIRED: WIN32_ERROR = 1938u32; +pub const ERROR_PASSWORD_EXPIRED: WIN32_ERROR = 1330u32; +pub const ERROR_PASSWORD_MUST_CHANGE: WIN32_ERROR = 1907u32; +pub const ERROR_PASSWORD_RESTRICTION: WIN32_ERROR = 1325u32; +pub const ERROR_PATCH_MANAGED_ADVERTISED_PRODUCT: WIN32_ERROR = 1651u32; +pub const ERROR_PATCH_NO_SEQUENCE: WIN32_ERROR = 1648u32; +pub const ERROR_PATCH_PACKAGE_INVALID: WIN32_ERROR = 1636u32; +pub const ERROR_PATCH_PACKAGE_OPEN_FAILED: WIN32_ERROR = 1635u32; +pub const ERROR_PATCH_PACKAGE_REJECTED: WIN32_ERROR = 1643u32; +pub const ERROR_PATCH_PACKAGE_UNSUPPORTED: WIN32_ERROR = 1637u32; +pub const ERROR_PATCH_REMOVAL_DISALLOWED: WIN32_ERROR = 1649u32; +pub const ERROR_PATCH_REMOVAL_UNSUPPORTED: WIN32_ERROR = 1646u32; +pub const ERROR_PATCH_TARGET_NOT_FOUND: WIN32_ERROR = 1642u32; +pub const ERROR_PATH_BUSY: WIN32_ERROR = 148u32; +pub const ERROR_PATH_NOT_FOUND: WIN32_ERROR = 3u32; +pub const ERROR_PER_USER_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1932u32; +pub const ERROR_PIPE_BUSY: WIN32_ERROR = 231u32; +pub const ERROR_PIPE_CONNECTED: WIN32_ERROR = 535u32; +pub const ERROR_PIPE_LISTENING: WIN32_ERROR = 536u32; +pub const ERROR_PIPE_LOCAL: WIN32_ERROR = 229u32; +pub const ERROR_PIPE_NOT_CONNECTED: WIN32_ERROR = 233u32; +pub const ERROR_PKINIT_FAILURE: WIN32_ERROR = 1263u32; +pub const ERROR_PLUGPLAY_QUERY_VETOED: WIN32_ERROR = 683u32; +pub const ERROR_PNP_BAD_MPS_TABLE: WIN32_ERROR = 671u32; +pub const ERROR_PNP_INVALID_ID: WIN32_ERROR = 674u32; +pub const ERROR_PNP_IRQ_TRANSLATION_FAILED: WIN32_ERROR = 673u32; +pub const ERROR_PNP_QUERY_REMOVE_DEVICE_TIMEOUT: WIN32_ERROR = 480u32; +pub const ERROR_PNP_QUERY_REMOVE_RELATED_DEVICE_TIMEOUT: WIN32_ERROR = 481u32; +pub const ERROR_PNP_QUERY_REMOVE_UNRELATED_DEVICE_TIMEOUT: WIN32_ERROR = 482u32; +pub const ERROR_PNP_REBOOT_REQUIRED: WIN32_ERROR = 638u32; +pub const ERROR_PNP_RESTART_ENUMERATION: WIN32_ERROR = 636u32; +pub const ERROR_PNP_TRANSLATION_FAILED: WIN32_ERROR = 672u32; +pub const ERROR_POINT_NOT_FOUND: WIN32_ERROR = 1171u32; +pub const ERROR_POLICY_OBJECT_NOT_FOUND: WIN32_ERROR = 8219u32; +pub const ERROR_POLICY_ONLY_IN_DS: WIN32_ERROR = 8220u32; +pub const ERROR_POPUP_ALREADY_ACTIVE: WIN32_ERROR = 1446u32; +pub const ERROR_PORT_MESSAGE_TOO_LONG: WIN32_ERROR = 546u32; +pub const ERROR_PORT_NOT_SET: WIN32_ERROR = 642u32; +pub const ERROR_PORT_UNREACHABLE: WIN32_ERROR = 1234u32; +pub const ERROR_POSSIBLE_DEADLOCK: WIN32_ERROR = 1131u32; +pub const ERROR_POTENTIAL_FILE_FOUND: WIN32_ERROR = 1180u32; +pub const ERROR_PREDEFINED_HANDLE: WIN32_ERROR = 714u32; +pub const ERROR_PRIMARY_TRANSPORT_CONNECT_FAILED: WIN32_ERROR = 746u32; +pub const ERROR_PRINTER_ALREADY_EXISTS: WIN32_ERROR = 1802u32; +pub const ERROR_PRINTER_DELETED: WIN32_ERROR = 1905u32; +pub const ERROR_PRINTER_DRIVER_ALREADY_INSTALLED: WIN32_ERROR = 1795u32; +pub const ERROR_PRINTQ_FULL: WIN32_ERROR = 61u32; +pub const ERROR_PRINT_CANCELLED: WIN32_ERROR = 63u32; +pub const ERROR_PRIVATE_DIALOG_INDEX: WIN32_ERROR = 1415u32; +pub const ERROR_PRIVILEGE_NOT_HELD: WIN32_ERROR = 1314u32; +pub const ERROR_PROCESS_ABORTED: WIN32_ERROR = 1067u32; +pub const ERROR_PROCESS_IN_JOB: WIN32_ERROR = 760u32; +pub const ERROR_PROCESS_IS_PROTECTED: WIN32_ERROR = 1293u32; +pub const ERROR_PROCESS_MODE_ALREADY_BACKGROUND: WIN32_ERROR = 402u32; +pub const ERROR_PROCESS_MODE_NOT_BACKGROUND: WIN32_ERROR = 403u32; +pub const ERROR_PROCESS_NOT_IN_JOB: WIN32_ERROR = 759u32; +pub const ERROR_PROC_NOT_FOUND: WIN32_ERROR = 127u32; +pub const ERROR_PRODUCT_UNINSTALLED: WIN32_ERROR = 1614u32; +pub const ERROR_PRODUCT_VERSION: WIN32_ERROR = 1638u32; +pub const ERROR_PROFILING_AT_LIMIT: WIN32_ERROR = 553u32; +pub const ERROR_PROFILING_NOT_STARTED: WIN32_ERROR = 550u32; +pub const ERROR_PROFILING_NOT_STOPPED: WIN32_ERROR = 551u32; +pub const ERROR_PROMOTION_ACTIVE: WIN32_ERROR = 8221u32; +pub const ERROR_PROTOCOL_UNREACHABLE: WIN32_ERROR = 1233u32; +pub const ERROR_PWD_HISTORY_CONFLICT: WIN32_ERROR = 617u32; +pub const ERROR_PWD_TOO_LONG: WIN32_ERROR = 657u32; +pub const ERROR_PWD_TOO_RECENT: WIN32_ERROR = 616u32; +pub const ERROR_PWD_TOO_SHORT: WIN32_ERROR = 615u32; +pub const ERROR_QUOTA_ACTIVITY: WIN32_ERROR = 810u32; +pub const ERROR_QUOTA_LIST_INCONSISTENT: WIN32_ERROR = 621u32; +pub const ERROR_RANGE_LIST_CONFLICT: WIN32_ERROR = 627u32; +pub const ERROR_RANGE_NOT_FOUND: WIN32_ERROR = 644u32; +pub const ERROR_READ_FAULT: WIN32_ERROR = 30u32; +pub const ERROR_RECEIVE_EXPEDITED: WIN32_ERROR = 708u32; +pub const ERROR_RECEIVE_PARTIAL: WIN32_ERROR = 707u32; +pub const ERROR_RECEIVE_PARTIAL_EXPEDITED: WIN32_ERROR = 709u32; +pub const ERROR_RECOVERY_FAILURE: WIN32_ERROR = 1279u32; +pub const ERROR_REDIRECTOR_HAS_OPEN_HANDLES: WIN32_ERROR = 1794u32; +pub const ERROR_REDIR_PAUSED: WIN32_ERROR = 72u32; +pub const ERROR_REGISTRY_CORRUPT: WIN32_ERROR = 1015u32; +pub const ERROR_REGISTRY_HIVE_RECOVERED: WIN32_ERROR = 685u32; +pub const ERROR_REGISTRY_IO_FAILED: WIN32_ERROR = 1016u32; +pub const ERROR_REGISTRY_QUOTA_LIMIT: WIN32_ERROR = 613u32; +pub const ERROR_REGISTRY_RECOVERED: WIN32_ERROR = 1014u32; +pub const ERROR_REG_NAT_CONSUMPTION: WIN32_ERROR = 1261u32; +pub const ERROR_RELOC_CHAIN_XEEDS_SEGLIM: WIN32_ERROR = 201u32; +pub const ERROR_REMOTE_PRINT_CONNECTIONS_BLOCKED: WIN32_ERROR = 1936u32; +pub const ERROR_REMOTE_SESSION_LIMIT_EXCEEDED: WIN32_ERROR = 1220u32; +pub const ERROR_REMOTE_STORAGE_MEDIA_ERROR: WIN32_ERROR = 4352u32; +pub const ERROR_REMOTE_STORAGE_NOT_ACTIVE: WIN32_ERROR = 4351u32; +pub const ERROR_REM_NOT_LIST: WIN32_ERROR = 51u32; +pub const ERROR_REPARSE: WIN32_ERROR = 741u32; +pub const ERROR_REPARSE_ATTRIBUTE_CONFLICT: WIN32_ERROR = 4391u32; +pub const ERROR_REPARSE_OBJECT: WIN32_ERROR = 755u32; +pub const ERROR_REPARSE_POINT_ENCOUNTERED: WIN32_ERROR = 4395u32; +pub const ERROR_REPARSE_TAG_INVALID: WIN32_ERROR = 4393u32; +pub const ERROR_REPARSE_TAG_MISMATCH: WIN32_ERROR = 4394u32; +pub const ERROR_REPLY_MESSAGE_MISMATCH: WIN32_ERROR = 595u32; +pub const ERROR_REQUEST_ABORTED: WIN32_ERROR = 1235u32; +pub const ERROR_REQUEST_OUT_OF_SEQUENCE: WIN32_ERROR = 776u32; +pub const ERROR_REQUEST_PAUSED: WIN32_ERROR = 3050u32; +pub const ERROR_REQUIRES_INTERACTIVE_WINDOWSTATION: WIN32_ERROR = 1459u32; +pub const ERROR_REQ_NOT_ACCEP: WIN32_ERROR = 71u32; +pub const ERROR_RESIDENT_FILE_NOT_SUPPORTED: WIN32_ERROR = 334u32; +pub const ERROR_RESOURCE_CALL_TIMED_OUT: WIN32_ERROR = 5910u32; +pub const ERROR_RESOURCE_DATA_NOT_FOUND: WIN32_ERROR = 1812u32; +pub const ERROR_RESOURCE_LANG_NOT_FOUND: WIN32_ERROR = 1815u32; +pub const ERROR_RESOURCE_NAME_NOT_FOUND: WIN32_ERROR = 1814u32; +pub const ERROR_RESOURCE_REQUIREMENTS_CHANGED: WIN32_ERROR = 756u32; +pub const ERROR_RESOURCE_TYPE_NOT_FOUND: WIN32_ERROR = 1813u32; +pub const ERROR_RESTART_APPLICATION: WIN32_ERROR = 1467u32; +pub const ERROR_RESUME_HIBERNATION: WIN32_ERROR = 727u32; +pub const ERROR_RETRY: WIN32_ERROR = 1237u32; +pub const ERROR_RETURN_ADDRESS_HIJACK_ATTEMPT: WIN32_ERROR = 1662u32; +pub const ERROR_REVISION_MISMATCH: WIN32_ERROR = 1306u32; +pub const ERROR_RING2SEG_MUST_BE_MOVABLE: WIN32_ERROR = 200u32; +pub const ERROR_RING2_STACK_IN_USE: WIN32_ERROR = 207u32; +pub const ERROR_RMODE_APP: WIN32_ERROR = 1153u32; +pub const ERROR_ROWSNOTRELEASED: WIN32_ERROR = 772u32; +pub const ERROR_RUNLEVEL_SWITCH_AGENT_TIMEOUT: WIN32_ERROR = 15403u32; +pub const ERROR_RUNLEVEL_SWITCH_TIMEOUT: WIN32_ERROR = 15402u32; +pub const ERROR_RWRAW_ENCRYPTED_FILE_NOT_ENCRYPTED: WIN32_ERROR = 410u32; +pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILEOFFSET: WIN32_ERROR = 411u32; +pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_FILERANGE: WIN32_ERROR = 412u32; +pub const ERROR_RWRAW_ENCRYPTED_INVALID_EDATAINFO_PARAMETER: WIN32_ERROR = 413u32; +pub const ERROR_RXACT_COMMITTED: WIN32_ERROR = 744u32; +pub const ERROR_RXACT_COMMIT_FAILURE: WIN32_ERROR = 1370u32; +pub const ERROR_RXACT_COMMIT_NECESSARY: WIN32_ERROR = 678u32; +pub const ERROR_RXACT_INVALID_STATE: WIN32_ERROR = 1369u32; +pub const ERROR_RXACT_STATE_CREATED: WIN32_ERROR = 701u32; +pub const ERROR_SAME_DRIVE: WIN32_ERROR = 143u32; +pub const ERROR_SAM_INIT_FAILURE: WIN32_ERROR = 8541u32; +pub const ERROR_SCOPE_NOT_FOUND: WIN32_ERROR = 318u32; +pub const ERROR_SCREEN_ALREADY_LOCKED: WIN32_ERROR = 1440u32; +pub const ERROR_SCRUB_DATA_DISABLED: WIN32_ERROR = 332u32; +pub const ERROR_SECRET_TOO_LONG: WIN32_ERROR = 1382u32; +pub const ERROR_SECTION_DIRECT_MAP_ONLY: WIN32_ERROR = 819u32; +pub const ERROR_SECTOR_NOT_FOUND: WIN32_ERROR = 27u32; +pub const ERROR_SECURITY_DENIES_OPERATION: WIN32_ERROR = 447u32; +pub const ERROR_SECURITY_STREAM_IS_INCONSISTENT: WIN32_ERROR = 306u32; +pub const ERROR_SEEK: WIN32_ERROR = 25u32; +pub const ERROR_SEEK_ON_DEVICE: WIN32_ERROR = 132u32; +pub const ERROR_SEGMENT_NOTIFICATION: WIN32_ERROR = 702u32; +pub const ERROR_SEM_IS_SET: WIN32_ERROR = 102u32; +pub const ERROR_SEM_NOT_FOUND: WIN32_ERROR = 187u32; +pub const ERROR_SEM_OWNER_DIED: WIN32_ERROR = 105u32; +pub const ERROR_SEM_TIMEOUT: WIN32_ERROR = 121u32; +pub const ERROR_SEM_USER_LIMIT: WIN32_ERROR = 106u32; +pub const ERROR_SERIAL_NO_DEVICE: WIN32_ERROR = 1118u32; +pub const ERROR_SERVER_DISABLED: WIN32_ERROR = 1341u32; +pub const ERROR_SERVER_HAS_OPEN_HANDLES: WIN32_ERROR = 1811u32; +pub const ERROR_SERVER_NOT_DISABLED: WIN32_ERROR = 1342u32; +pub const ERROR_SERVER_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1255u32; +pub const ERROR_SERVER_SID_MISMATCH: WIN32_ERROR = 628u32; +pub const ERROR_SERVER_TRANSPORT_CONFLICT: WIN32_ERROR = 816u32; +pub const ERROR_SERVICE_ALREADY_RUNNING: WIN32_ERROR = 1056u32; +pub const ERROR_SERVICE_CANNOT_ACCEPT_CTRL: WIN32_ERROR = 1061u32; +pub const ERROR_SERVICE_DATABASE_LOCKED: WIN32_ERROR = 1055u32; +pub const ERROR_SERVICE_DEPENDENCY_DELETED: WIN32_ERROR = 1075u32; +pub const ERROR_SERVICE_DEPENDENCY_FAIL: WIN32_ERROR = 1068u32; +pub const ERROR_SERVICE_DISABLED: WIN32_ERROR = 1058u32; +pub const ERROR_SERVICE_DOES_NOT_EXIST: WIN32_ERROR = 1060u32; +pub const ERROR_SERVICE_EXISTS: WIN32_ERROR = 1073u32; +pub const ERROR_SERVICE_LOGON_FAILED: WIN32_ERROR = 1069u32; +pub const ERROR_SERVICE_MARKED_FOR_DELETE: WIN32_ERROR = 1072u32; +pub const ERROR_SERVICE_NEVER_STARTED: WIN32_ERROR = 1077u32; +pub const ERROR_SERVICE_NOTIFICATION: WIN32_ERROR = 716u32; +pub const ERROR_SERVICE_NOTIFY_CLIENT_LAGGING: WIN32_ERROR = 1294u32; +pub const ERROR_SERVICE_NOT_ACTIVE: WIN32_ERROR = 1062u32; +pub const ERROR_SERVICE_NOT_FOUND: WIN32_ERROR = 1243u32; +pub const ERROR_SERVICE_NOT_IN_EXE: WIN32_ERROR = 1083u32; +pub const ERROR_SERVICE_NO_THREAD: WIN32_ERROR = 1054u32; +pub const ERROR_SERVICE_REQUEST_TIMEOUT: WIN32_ERROR = 1053u32; +pub const ERROR_SERVICE_SPECIFIC_ERROR: WIN32_ERROR = 1066u32; +pub const ERROR_SERVICE_START_HANG: WIN32_ERROR = 1070u32; +pub const ERROR_SESSION_CREDENTIAL_CONFLICT: WIN32_ERROR = 1219u32; +pub const ERROR_SESSION_KEY_TOO_SHORT: WIN32_ERROR = 501u32; +pub const ERROR_SETCOUNT_ON_BAD_LB: WIN32_ERROR = 1433u32; +pub const ERROR_SETMARK_DETECTED: WIN32_ERROR = 1103u32; +pub const ERROR_SET_CONTEXT_DENIED: WIN32_ERROR = 1660u32; +pub const ERROR_SET_NOT_FOUND: WIN32_ERROR = 1170u32; +pub const ERROR_SET_POWER_STATE_FAILED: WIN32_ERROR = 1141u32; +pub const ERROR_SET_POWER_STATE_VETOED: WIN32_ERROR = 1140u32; +pub const ERROR_SHARED_POLICY: WIN32_ERROR = 8218u32; +pub const ERROR_SHARING_BUFFER_EXCEEDED: WIN32_ERROR = 36u32; +pub const ERROR_SHARING_PAUSED: WIN32_ERROR = 70u32; +pub const ERROR_SHARING_VIOLATION: WIN32_ERROR = 32u32; +pub const ERROR_SHORT_NAMES_NOT_ENABLED_ON_VOLUME: WIN32_ERROR = 305u32; +pub const ERROR_SHUTDOWN_DISKS_NOT_IN_MAINTENANCE_MODE: WIN32_ERROR = 1192u32; +pub const ERROR_SHUTDOWN_IN_PROGRESS: WIN32_ERROR = 1115u32; +pub const ERROR_SHUTDOWN_IS_SCHEDULED: WIN32_ERROR = 1190u32; +pub const ERROR_SHUTDOWN_USERS_LOGGED_ON: WIN32_ERROR = 1191u32; +pub const ERROR_SIGNAL_PENDING: WIN32_ERROR = 162u32; +pub const ERROR_SIGNAL_REFUSED: WIN32_ERROR = 156u32; +pub const ERROR_SINGLE_INSTANCE_APP: WIN32_ERROR = 1152u32; +pub const ERROR_SMARTCARD_SUBSYSTEM_FAILURE: WIN32_ERROR = 1264u32; +pub const ERROR_SMB1_NOT_AVAILABLE: WIN32_ERROR = 384u32; +pub const ERROR_SMB_GUEST_LOGON_BLOCKED: WIN32_ERROR = 1272u32; +pub const ERROR_SMR_GARBAGE_COLLECTION_REQUIRED: WIN32_ERROR = 4445u32; +pub const ERROR_SOME_NOT_MAPPED: WIN32_ERROR = 1301u32; +pub const ERROR_SOURCE_ELEMENT_EMPTY: WIN32_ERROR = 1160u32; +pub const ERROR_SPARSE_FILE_NOT_SUPPORTED: WIN32_ERROR = 490u32; +pub const ERROR_SPECIAL_ACCOUNT: WIN32_ERROR = 1371u32; +pub const ERROR_SPECIAL_GROUP: WIN32_ERROR = 1372u32; +pub const ERROR_SPECIAL_USER: WIN32_ERROR = 1373u32; +pub const ERROR_SRC_SRV_DLL_LOAD_FAILED: WIN32_ERROR = 428u32; +pub const ERROR_STACK_BUFFER_OVERRUN: WIN32_ERROR = 1282u32; +pub const ERROR_STACK_OVERFLOW: WIN32_ERROR = 1001u32; +pub const ERROR_STACK_OVERFLOW_READ: WIN32_ERROR = 599u32; +pub const ERROR_STOPPED_ON_SYMLINK: WIN32_ERROR = 681u32; +pub const ERROR_STORAGE_LOST_DATA_PERSISTENCE: WIN32_ERROR = 368u32; +pub const ERROR_STORAGE_RESERVE_ALREADY_EXISTS: WIN32_ERROR = 418u32; +pub const ERROR_STORAGE_RESERVE_DOES_NOT_EXIST: WIN32_ERROR = 417u32; +pub const ERROR_STORAGE_RESERVE_ID_INVALID: WIN32_ERROR = 416u32; +pub const ERROR_STORAGE_RESERVE_NOT_EMPTY: WIN32_ERROR = 419u32; +pub const ERROR_STORAGE_STACK_ACCESS_DENIED: WIN32_ERROR = 472u32; +pub const ERROR_STORAGE_TOPOLOGY_ID_MISMATCH: WIN32_ERROR = 345u32; +pub const ERROR_STRICT_CFG_VIOLATION: WIN32_ERROR = 1657u32; +pub const ERROR_SUBST_TO_JOIN: WIN32_ERROR = 141u32; +pub const ERROR_SUBST_TO_SUBST: WIN32_ERROR = 139u32; +pub const ERROR_SUCCESS: WIN32_ERROR = 0u32; +pub const ERROR_SUCCESS_REBOOT_INITIATED: WIN32_ERROR = 1641u32; +pub const ERROR_SWAPERROR: WIN32_ERROR = 999u32; +pub const ERROR_SYMLINK_CLASS_DISABLED: WIN32_ERROR = 1463u32; +pub const ERROR_SYMLINK_NOT_SUPPORTED: WIN32_ERROR = 1464u32; +pub const ERROR_SYNCHRONIZATION_REQUIRED: WIN32_ERROR = 569u32; +pub const ERROR_SYNC_FOREGROUND_REFRESH_REQUIRED: WIN32_ERROR = 1274u32; +pub const ERROR_SYSTEM_HIVE_TOO_LARGE: WIN32_ERROR = 653u32; +pub const ERROR_SYSTEM_IMAGE_BAD_SIGNATURE: WIN32_ERROR = 637u32; +pub const ERROR_SYSTEM_POWERSTATE_COMPLEX_TRANSITION: WIN32_ERROR = 783u32; +pub const ERROR_SYSTEM_POWERSTATE_TRANSITION: WIN32_ERROR = 782u32; +pub const ERROR_SYSTEM_PROCESS_TERMINATED: WIN32_ERROR = 591u32; +pub const ERROR_SYSTEM_SHUTDOWN: WIN32_ERROR = 641u32; +pub const ERROR_SYSTEM_TRACE: WIN32_ERROR = 150u32; +pub const ERROR_THREAD_1_INACTIVE: WIN32_ERROR = 210u32; +pub const ERROR_THREAD_ALREADY_IN_TASK: WIN32_ERROR = 1552u32; +pub const ERROR_THREAD_MODE_ALREADY_BACKGROUND: WIN32_ERROR = 400u32; +pub const ERROR_THREAD_MODE_NOT_BACKGROUND: WIN32_ERROR = 401u32; +pub const ERROR_THREAD_NOT_IN_PROCESS: WIN32_ERROR = 566u32; +pub const ERROR_THREAD_WAS_SUSPENDED: WIN32_ERROR = 699u32; +pub const ERROR_TIMEOUT: WIN32_ERROR = 1460u32; +pub const ERROR_TIMER_NOT_CANCELED: WIN32_ERROR = 541u32; +pub const ERROR_TIMER_RESOLUTION_NOT_SET: WIN32_ERROR = 607u32; +pub const ERROR_TIMER_RESUME_IGNORED: WIN32_ERROR = 722u32; +pub const ERROR_TIME_SENSITIVE_THREAD: WIN32_ERROR = 422u32; +pub const ERROR_TIME_SKEW: WIN32_ERROR = 1398u32; +pub const ERROR_TLW_WITH_WSCHILD: WIN32_ERROR = 1406u32; +pub const ERROR_TOKEN_ALREADY_IN_USE: WIN32_ERROR = 1375u32; +pub const ERROR_TOO_MANY_CMDS: WIN32_ERROR = 56u32; +pub const ERROR_TOO_MANY_CONTEXT_IDS: WIN32_ERROR = 1384u32; +pub const ERROR_TOO_MANY_DESCRIPTORS: WIN32_ERROR = 331u32; +pub const ERROR_TOO_MANY_LINKS: WIN32_ERROR = 1142u32; +pub const ERROR_TOO_MANY_LUIDS_REQUESTED: WIN32_ERROR = 1333u32; +pub const ERROR_TOO_MANY_MODULES: WIN32_ERROR = 214u32; +pub const ERROR_TOO_MANY_MUXWAITERS: WIN32_ERROR = 152u32; +pub const ERROR_TOO_MANY_NAMES: WIN32_ERROR = 68u32; +pub const ERROR_TOO_MANY_OPEN_FILES: WIN32_ERROR = 4u32; +pub const ERROR_TOO_MANY_POSTS: WIN32_ERROR = 298u32; +pub const ERROR_TOO_MANY_SECRETS: WIN32_ERROR = 1381u32; +pub const ERROR_TOO_MANY_SEMAPHORES: WIN32_ERROR = 100u32; +pub const ERROR_TOO_MANY_SEM_REQUESTS: WIN32_ERROR = 103u32; +pub const ERROR_TOO_MANY_SESS: WIN32_ERROR = 69u32; +pub const ERROR_TOO_MANY_SIDS: WIN32_ERROR = 1389u32; +pub const ERROR_TOO_MANY_TCBS: WIN32_ERROR = 155u32; +pub const ERROR_TOO_MANY_THREADS: WIN32_ERROR = 565u32; +pub const ERROR_TRANSLATION_COMPLETE: WIN32_ERROR = 757u32; +pub const ERROR_TRUSTED_DOMAIN_FAILURE: WIN32_ERROR = 1788u32; +pub const ERROR_TRUSTED_RELATIONSHIP_FAILURE: WIN32_ERROR = 1789u32; +pub const ERROR_TRUST_FAILURE: WIN32_ERROR = 1790u32; +pub const ERROR_UNABLE_TO_LOCK_MEDIA: WIN32_ERROR = 1108u32; +pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT: WIN32_ERROR = 1176u32; +pub const ERROR_UNABLE_TO_MOVE_REPLACEMENT_2: WIN32_ERROR = 1177u32; +pub const ERROR_UNABLE_TO_REMOVE_REPLACED: WIN32_ERROR = 1175u32; +pub const ERROR_UNABLE_TO_UNLOAD_MEDIA: WIN32_ERROR = 1109u32; +pub const ERROR_UNDEFINED_CHARACTER: WIN32_ERROR = 583u32; +pub const ERROR_UNDEFINED_SCOPE: WIN32_ERROR = 319u32; +pub const ERROR_UNEXPECTED_MM_CREATE_ERR: WIN32_ERROR = 556u32; +pub const ERROR_UNEXPECTED_MM_EXTEND_ERR: WIN32_ERROR = 558u32; +pub const ERROR_UNEXPECTED_MM_MAP_ERROR: WIN32_ERROR = 557u32; +pub const ERROR_UNEXPECTED_NTCACHEMANAGER_ERROR: WIN32_ERROR = 443u32; +pub const ERROR_UNEXP_NET_ERR: WIN32_ERROR = 59u32; +pub const ERROR_UNHANDLED_EXCEPTION: WIN32_ERROR = 574u32; +pub const ERROR_UNIDENTIFIED_ERROR: WIN32_ERROR = 1287u32; +pub const ERROR_UNKNOWN_COMPONENT: WIN32_ERROR = 1607u32; +pub const ERROR_UNKNOWN_FEATURE: WIN32_ERROR = 1606u32; +pub const ERROR_UNKNOWN_PATCH: WIN32_ERROR = 1647u32; +pub const ERROR_UNKNOWN_PORT: WIN32_ERROR = 1796u32; +pub const ERROR_UNKNOWN_PRINTER_DRIVER: WIN32_ERROR = 1797u32; +pub const ERROR_UNKNOWN_PRINTPROCESSOR: WIN32_ERROR = 1798u32; +pub const ERROR_UNKNOWN_PRODUCT: WIN32_ERROR = 1605u32; +pub const ERROR_UNKNOWN_PROPERTY: WIN32_ERROR = 1608u32; +pub const ERROR_UNKNOWN_REVISION: WIN32_ERROR = 1305u32; +pub const ERROR_UNRECOGNIZED_MEDIA: WIN32_ERROR = 1785u32; +pub const ERROR_UNRECOGNIZED_VOLUME: WIN32_ERROR = 1005u32; +pub const ERROR_UNSATISFIED_DEPENDENCIES: WIN32_ERROR = 441u32; +pub const ERROR_UNSUPPORTED_COMPRESSION: WIN32_ERROR = 618u32; +pub const ERROR_UNSUPPORTED_TYPE: WIN32_ERROR = 1630u32; +pub const ERROR_UNTRUSTED_MOUNT_POINT: WIN32_ERROR = 448u32; +pub const ERROR_UNWIND: WIN32_ERROR = 542u32; +pub const ERROR_UNWIND_CONSOLIDATE: WIN32_ERROR = 684u32; +pub const ERROR_USER_APC: WIN32_ERROR = 737u32; +pub const ERROR_USER_DELETE_TRUST_QUOTA_EXCEEDED: WIN32_ERROR = 1934u32; +pub const ERROR_USER_EXISTS: WIN32_ERROR = 1316u32; +pub const ERROR_USER_MAPPED_FILE: WIN32_ERROR = 1224u32; +pub const ERROR_USER_PROFILE_LOAD: WIN32_ERROR = 500u32; +pub const ERROR_VALIDATE_CONTINUE: WIN32_ERROR = 625u32; +pub const ERROR_VC_DISCONNECTED: WIN32_ERROR = 240u32; +pub const ERROR_VDM_DISALLOWED: WIN32_ERROR = 1286u32; +pub const ERROR_VDM_HARD_ERROR: WIN32_ERROR = 593u32; +pub const ERROR_VERIFIER_STOP: WIN32_ERROR = 537u32; +pub const ERROR_VERSION_PARSE_ERROR: WIN32_ERROR = 777u32; +pub const ERROR_VIRUS_DELETED: WIN32_ERROR = 226u32; +pub const ERROR_VIRUS_INFECTED: WIN32_ERROR = 225u32; +pub const ERROR_VOLSNAP_HIBERNATE_READY: WIN32_ERROR = 761u32; +pub const ERROR_VOLSNAP_PREPARE_HIBERNATE: WIN32_ERROR = 655u32; +pub const ERROR_VOLUME_MOUNTED: WIN32_ERROR = 743u32; +pub const ERROR_VOLUME_NOT_CLUSTER_ALIGNED: WIN32_ERROR = 407u32; +pub const ERROR_VOLUME_NOT_SIS_ENABLED: WIN32_ERROR = 4500u32; +pub const ERROR_VOLUME_NOT_SUPPORTED: WIN32_ERROR = 492u32; +pub const ERROR_VOLUME_NOT_SUPPORT_EFS: WIN32_ERROR = 6014u32; +pub const ERROR_VOLUME_WRITE_ACCESS_DENIED: WIN32_ERROR = 508u32; +pub const ERROR_WAIT_1: WIN32_ERROR = 731u32; +pub const ERROR_WAIT_2: WIN32_ERROR = 732u32; +pub const ERROR_WAIT_3: WIN32_ERROR = 733u32; +pub const ERROR_WAIT_63: WIN32_ERROR = 734u32; +pub const ERROR_WAIT_FOR_OPLOCK: WIN32_ERROR = 765u32; +pub const ERROR_WAIT_NO_CHILDREN: WIN32_ERROR = 128u32; +pub const ERROR_WAKE_SYSTEM: WIN32_ERROR = 730u32; +pub const ERROR_WAKE_SYSTEM_DEBUGGER: WIN32_ERROR = 675u32; +pub const ERROR_WAS_LOCKED: WIN32_ERROR = 717u32; +pub const ERROR_WAS_UNLOCKED: WIN32_ERROR = 715u32; +pub const ERROR_WEAK_WHFBKEY_BLOCKED: WIN32_ERROR = 8651u32; +pub const ERROR_WINDOW_NOT_COMBOBOX: WIN32_ERROR = 1423u32; +pub const ERROR_WINDOW_NOT_DIALOG: WIN32_ERROR = 1420u32; +pub const ERROR_WINDOW_OF_OTHER_THREAD: WIN32_ERROR = 1408u32; +pub const ERROR_WIP_ENCRYPTION_FAILED: WIN32_ERROR = 6023u32; +pub const ERROR_WOF_FILE_RESOURCE_TABLE_CORRUPT: WIN32_ERROR = 4448u32; +pub const ERROR_WOF_WIM_HEADER_CORRUPT: WIN32_ERROR = 4446u32; +pub const ERROR_WOF_WIM_RESOURCE_TABLE_CORRUPT: WIN32_ERROR = 4447u32; +pub const ERROR_WORKING_SET_QUOTA: WIN32_ERROR = 1453u32; +pub const ERROR_WOW_ASSERTION: WIN32_ERROR = 670u32; +pub const ERROR_WRITE_FAULT: WIN32_ERROR = 29u32; +pub const ERROR_WRITE_PROTECT: WIN32_ERROR = 19u32; +pub const ERROR_WRONG_COMPARTMENT: WIN32_ERROR = 1468u32; +pub const ERROR_WRONG_DISK: WIN32_ERROR = 34u32; +pub const ERROR_WRONG_EFS: WIN32_ERROR = 6005u32; +pub const ERROR_WRONG_PASSWORD: WIN32_ERROR = 1323u32; +pub const ERROR_WRONG_TARGET_NAME: WIN32_ERROR = 1396u32; +pub const ERROR_WX86_ERROR: WIN32_ERROR = 540u32; +pub const ERROR_WX86_WARNING: WIN32_ERROR = 539u32; +pub const ERROR_XMLDSIG_ERROR: WIN32_ERROR = 1466u32; +pub const ERROR_XML_PARSE_ERROR: WIN32_ERROR = 1465u32; +pub type EXCEPTION_DISPOSITION = i32; +pub const EXCEPTION_MAXIMUM_PARAMETERS: u32 = 15u32; +#[repr(C)] +pub struct EXCEPTION_POINTERS { + pub ExceptionRecord: *mut EXCEPTION_RECORD, + pub ContextRecord: *mut CONTEXT, +} +impl ::core::marker::Copy for EXCEPTION_POINTERS {} +impl ::core::clone::Clone for EXCEPTION_POINTERS { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct EXCEPTION_RECORD { + pub ExceptionCode: NTSTATUS, + pub ExceptionFlags: u32, + pub ExceptionRecord: *mut EXCEPTION_RECORD, + pub ExceptionAddress: *mut ::core::ffi::c_void, + pub NumberParameters: u32, + pub ExceptionInformation: [usize; 15], +} +impl ::core::marker::Copy for EXCEPTION_RECORD {} +impl ::core::clone::Clone for EXCEPTION_RECORD { + fn clone(&self) -> Self { + *self + } +} +pub const EXCEPTION_STACK_OVERFLOW: NTSTATUS = -1073741571i32; +pub const EXTENDED_STARTUPINFO_PRESENT: PROCESS_CREATION_FLAGS = 524288u32; +pub const E_NOTIMPL: HRESULT = -2147467263i32; +pub const ExceptionCollidedUnwind: EXCEPTION_DISPOSITION = 3i32; +pub const ExceptionContinueExecution: EXCEPTION_DISPOSITION = 0i32; +pub const ExceptionContinueSearch: EXCEPTION_DISPOSITION = 1i32; +pub const ExceptionNestedException: EXCEPTION_DISPOSITION = 2i32; +pub type FACILITY_CODE = u32; +pub const FACILITY_NT_BIT: FACILITY_CODE = 268435456u32; +pub const FALSE: BOOL = 0i32; +pub type FARPROC = ::core::option::Option isize>; +#[repr(C)] +pub struct FD_SET { + pub fd_count: u32, + pub fd_array: [SOCKET; 64], +} +impl ::core::marker::Copy for FD_SET {} +impl ::core::clone::Clone for FD_SET { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct FILETIME { + pub dwLowDateTime: u32, + pub dwHighDateTime: u32, +} +impl ::core::marker::Copy for FILETIME {} +impl ::core::clone::Clone for FILETIME { + fn clone(&self) -> Self { + *self + } +} +pub type FILE_ACCESS_RIGHTS = u32; +pub const FILE_ADD_FILE: FILE_ACCESS_RIGHTS = 2u32; +pub const FILE_ADD_SUBDIRECTORY: FILE_ACCESS_RIGHTS = 4u32; +pub const FILE_ALL_ACCESS: FILE_ACCESS_RIGHTS = 2032127u32; +pub const FILE_APPEND_DATA: FILE_ACCESS_RIGHTS = 4u32; +pub const FILE_ATTRIBUTE_ARCHIVE: FILE_FLAGS_AND_ATTRIBUTES = 32u32; +pub const FILE_ATTRIBUTE_COMPRESSED: FILE_FLAGS_AND_ATTRIBUTES = 2048u32; +pub const FILE_ATTRIBUTE_DEVICE: FILE_FLAGS_AND_ATTRIBUTES = 64u32; +pub const FILE_ATTRIBUTE_DIRECTORY: FILE_FLAGS_AND_ATTRIBUTES = 16u32; +pub const FILE_ATTRIBUTE_EA: FILE_FLAGS_AND_ATTRIBUTES = 262144u32; +pub const FILE_ATTRIBUTE_ENCRYPTED: FILE_FLAGS_AND_ATTRIBUTES = 16384u32; +pub const FILE_ATTRIBUTE_HIDDEN: FILE_FLAGS_AND_ATTRIBUTES = 2u32; +pub const FILE_ATTRIBUTE_INTEGRITY_STREAM: FILE_FLAGS_AND_ATTRIBUTES = 32768u32; +pub const FILE_ATTRIBUTE_NORMAL: FILE_FLAGS_AND_ATTRIBUTES = 128u32; +pub const FILE_ATTRIBUTE_NOT_CONTENT_INDEXED: FILE_FLAGS_AND_ATTRIBUTES = 8192u32; +pub const FILE_ATTRIBUTE_NO_SCRUB_DATA: FILE_FLAGS_AND_ATTRIBUTES = 131072u32; +pub const FILE_ATTRIBUTE_OFFLINE: FILE_FLAGS_AND_ATTRIBUTES = 4096u32; +pub const FILE_ATTRIBUTE_PINNED: FILE_FLAGS_AND_ATTRIBUTES = 524288u32; +pub const FILE_ATTRIBUTE_READONLY: FILE_FLAGS_AND_ATTRIBUTES = 1u32; +pub const FILE_ATTRIBUTE_RECALL_ON_DATA_ACCESS: FILE_FLAGS_AND_ATTRIBUTES = 4194304u32; +pub const FILE_ATTRIBUTE_RECALL_ON_OPEN: FILE_FLAGS_AND_ATTRIBUTES = 262144u32; +pub const FILE_ATTRIBUTE_REPARSE_POINT: FILE_FLAGS_AND_ATTRIBUTES = 1024u32; +pub const FILE_ATTRIBUTE_SPARSE_FILE: FILE_FLAGS_AND_ATTRIBUTES = 512u32; +pub const FILE_ATTRIBUTE_SYSTEM: FILE_FLAGS_AND_ATTRIBUTES = 4u32; +#[repr(C)] +pub struct FILE_ATTRIBUTE_TAG_INFO { + pub FileAttributes: u32, + pub ReparseTag: u32, +} +impl ::core::marker::Copy for FILE_ATTRIBUTE_TAG_INFO {} +impl ::core::clone::Clone for FILE_ATTRIBUTE_TAG_INFO { + fn clone(&self) -> Self { + *self + } +} +pub const FILE_ATTRIBUTE_TEMPORARY: FILE_FLAGS_AND_ATTRIBUTES = 256u32; +pub const FILE_ATTRIBUTE_UNPINNED: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32; +pub const FILE_ATTRIBUTE_VIRTUAL: FILE_FLAGS_AND_ATTRIBUTES = 65536u32; +#[repr(C)] +pub struct FILE_BASIC_INFO { + pub CreationTime: i64, + pub LastAccessTime: i64, + pub LastWriteTime: i64, + pub ChangeTime: i64, + pub FileAttributes: u32, +} +impl ::core::marker::Copy for FILE_BASIC_INFO {} +impl ::core::clone::Clone for FILE_BASIC_INFO { + fn clone(&self) -> Self { + *self + } +} +pub const FILE_BEGIN: SET_FILE_POINTER_MOVE_METHOD = 0u32; +pub const FILE_COMPLETE_IF_OPLOCKED: NTCREATEFILE_CREATE_OPTIONS = 256u32; +pub const FILE_CONTAINS_EXTENDED_CREATE_INFORMATION: NTCREATEFILE_CREATE_OPTIONS = 268435456u32; +pub const FILE_CREATE: NTCREATEFILE_CREATE_DISPOSITION = 2u32; +pub const FILE_CREATE_PIPE_INSTANCE: FILE_ACCESS_RIGHTS = 4u32; +pub const FILE_CREATE_TREE_CONNECTION: NTCREATEFILE_CREATE_OPTIONS = 128u32; +pub type FILE_CREATION_DISPOSITION = u32; +pub const FILE_CURRENT: SET_FILE_POINTER_MOVE_METHOD = 1u32; +pub const FILE_DELETE_CHILD: FILE_ACCESS_RIGHTS = 64u32; +pub const FILE_DELETE_ON_CLOSE: NTCREATEFILE_CREATE_OPTIONS = 4096u32; +pub const FILE_DIRECTORY_FILE: NTCREATEFILE_CREATE_OPTIONS = 1u32; +pub const FILE_DISALLOW_EXCLUSIVE: NTCREATEFILE_CREATE_OPTIONS = 131072u32; +pub const FILE_DISPOSITION_FLAG_DELETE: FILE_DISPOSITION_INFO_EX_FLAGS = 1u32; +pub const FILE_DISPOSITION_FLAG_DO_NOT_DELETE: FILE_DISPOSITION_INFO_EX_FLAGS = 0u32; +pub const FILE_DISPOSITION_FLAG_FORCE_IMAGE_SECTION_CHECK: FILE_DISPOSITION_INFO_EX_FLAGS = 4u32; +pub const FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE: FILE_DISPOSITION_INFO_EX_FLAGS = 16u32; +pub const FILE_DISPOSITION_FLAG_ON_CLOSE: FILE_DISPOSITION_INFO_EX_FLAGS = 8u32; +pub const FILE_DISPOSITION_FLAG_POSIX_SEMANTICS: FILE_DISPOSITION_INFO_EX_FLAGS = 2u32; +#[repr(C)] +pub struct FILE_DISPOSITION_INFO { + pub DeleteFile: BOOLEAN, +} +impl ::core::marker::Copy for FILE_DISPOSITION_INFO {} +impl ::core::clone::Clone for FILE_DISPOSITION_INFO { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct FILE_DISPOSITION_INFO_EX { + pub Flags: FILE_DISPOSITION_INFO_EX_FLAGS, +} +impl ::core::marker::Copy for FILE_DISPOSITION_INFO_EX {} +impl ::core::clone::Clone for FILE_DISPOSITION_INFO_EX { + fn clone(&self) -> Self { + *self + } +} +pub type FILE_DISPOSITION_INFO_EX_FLAGS = u32; +pub const FILE_END: SET_FILE_POINTER_MOVE_METHOD = 2u32; +#[repr(C)] +pub struct FILE_END_OF_FILE_INFO { + pub EndOfFile: i64, +} +impl ::core::marker::Copy for FILE_END_OF_FILE_INFO {} +impl ::core::clone::Clone for FILE_END_OF_FILE_INFO { + fn clone(&self) -> Self { + *self + } +} +pub const FILE_EXECUTE: FILE_ACCESS_RIGHTS = 32u32; +pub type FILE_FLAGS_AND_ATTRIBUTES = u32; +pub const FILE_FLAG_BACKUP_SEMANTICS: FILE_FLAGS_AND_ATTRIBUTES = 33554432u32; +pub const FILE_FLAG_DELETE_ON_CLOSE: FILE_FLAGS_AND_ATTRIBUTES = 67108864u32; +pub const FILE_FLAG_FIRST_PIPE_INSTANCE: FILE_FLAGS_AND_ATTRIBUTES = 524288u32; +pub const FILE_FLAG_NO_BUFFERING: FILE_FLAGS_AND_ATTRIBUTES = 536870912u32; +pub const FILE_FLAG_OPEN_NO_RECALL: FILE_FLAGS_AND_ATTRIBUTES = 1048576u32; +pub const FILE_FLAG_OPEN_REPARSE_POINT: FILE_FLAGS_AND_ATTRIBUTES = 2097152u32; +pub const FILE_FLAG_OVERLAPPED: FILE_FLAGS_AND_ATTRIBUTES = 1073741824u32; +pub const FILE_FLAG_POSIX_SEMANTICS: FILE_FLAGS_AND_ATTRIBUTES = 16777216u32; +pub const FILE_FLAG_RANDOM_ACCESS: FILE_FLAGS_AND_ATTRIBUTES = 268435456u32; +pub const FILE_FLAG_SEQUENTIAL_SCAN: FILE_FLAGS_AND_ATTRIBUTES = 134217728u32; +pub const FILE_FLAG_SESSION_AWARE: FILE_FLAGS_AND_ATTRIBUTES = 8388608u32; +pub const FILE_FLAG_WRITE_THROUGH: FILE_FLAGS_AND_ATTRIBUTES = 2147483648u32; +pub const FILE_GENERIC_EXECUTE: FILE_ACCESS_RIGHTS = 1179808u32; +pub const FILE_GENERIC_READ: FILE_ACCESS_RIGHTS = 1179785u32; +pub const FILE_GENERIC_WRITE: FILE_ACCESS_RIGHTS = 1179926u32; +#[repr(C)] +pub struct FILE_ID_BOTH_DIR_INFO { + pub NextEntryOffset: u32, + pub FileIndex: u32, + pub CreationTime: i64, + pub LastAccessTime: i64, + pub LastWriteTime: i64, + pub ChangeTime: i64, + pub EndOfFile: i64, + pub AllocationSize: i64, + pub FileAttributes: u32, + pub FileNameLength: u32, + pub EaSize: u32, + pub ShortNameLength: i8, + pub ShortName: [u16; 12], + pub FileId: i64, + pub FileName: [u16; 1], +} +impl ::core::marker::Copy for FILE_ID_BOTH_DIR_INFO {} +impl ::core::clone::Clone for FILE_ID_BOTH_DIR_INFO { + fn clone(&self) -> Self { + *self + } +} +pub type FILE_INFO_BY_HANDLE_CLASS = i32; +pub const FILE_LIST_DIRECTORY: FILE_ACCESS_RIGHTS = 1u32; +pub const FILE_NAME_NORMALIZED: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32; +pub const FILE_NAME_OPENED: GETFINALPATHNAMEBYHANDLE_FLAGS = 8u32; +pub const FILE_NON_DIRECTORY_FILE: NTCREATEFILE_CREATE_OPTIONS = 64u32; +pub const FILE_NO_COMPRESSION: NTCREATEFILE_CREATE_OPTIONS = 32768u32; +pub const FILE_NO_EA_KNOWLEDGE: NTCREATEFILE_CREATE_OPTIONS = 512u32; +pub const FILE_NO_INTERMEDIATE_BUFFERING: NTCREATEFILE_CREATE_OPTIONS = 8u32; +pub const FILE_OPEN: NTCREATEFILE_CREATE_DISPOSITION = 1u32; +pub const FILE_OPEN_BY_FILE_ID: NTCREATEFILE_CREATE_OPTIONS = 8192u32; +pub const FILE_OPEN_FOR_BACKUP_INTENT: NTCREATEFILE_CREATE_OPTIONS = 16384u32; +pub const FILE_OPEN_FOR_FREE_SPACE_QUERY: NTCREATEFILE_CREATE_OPTIONS = 8388608u32; +pub const FILE_OPEN_IF: NTCREATEFILE_CREATE_DISPOSITION = 3u32; +pub const FILE_OPEN_NO_RECALL: NTCREATEFILE_CREATE_OPTIONS = 4194304u32; +pub const FILE_OPEN_REPARSE_POINT: NTCREATEFILE_CREATE_OPTIONS = 2097152u32; +pub const FILE_OPEN_REQUIRING_OPLOCK: NTCREATEFILE_CREATE_OPTIONS = 65536u32; +pub const FILE_OVERWRITE: NTCREATEFILE_CREATE_DISPOSITION = 4u32; +pub const FILE_OVERWRITE_IF: NTCREATEFILE_CREATE_DISPOSITION = 5u32; +pub const FILE_RANDOM_ACCESS: NTCREATEFILE_CREATE_OPTIONS = 2048u32; +pub const FILE_READ_ATTRIBUTES: FILE_ACCESS_RIGHTS = 128u32; +pub const FILE_READ_DATA: FILE_ACCESS_RIGHTS = 1u32; +pub const FILE_READ_EA: FILE_ACCESS_RIGHTS = 8u32; +pub const FILE_RESERVE_OPFILTER: NTCREATEFILE_CREATE_OPTIONS = 1048576u32; +pub const FILE_SEQUENTIAL_ONLY: NTCREATEFILE_CREATE_OPTIONS = 4u32; +pub const FILE_SESSION_AWARE: NTCREATEFILE_CREATE_OPTIONS = 262144u32; +pub const FILE_SHARE_DELETE: FILE_SHARE_MODE = 4u32; +pub type FILE_SHARE_MODE = u32; +pub const FILE_SHARE_NONE: FILE_SHARE_MODE = 0u32; +pub const FILE_SHARE_READ: FILE_SHARE_MODE = 1u32; +pub const FILE_SHARE_WRITE: FILE_SHARE_MODE = 2u32; +#[repr(C)] +pub struct FILE_STANDARD_INFO { + pub AllocationSize: i64, + pub EndOfFile: i64, + pub NumberOfLinks: u32, + pub DeletePending: BOOLEAN, + pub Directory: BOOLEAN, +} +impl ::core::marker::Copy for FILE_STANDARD_INFO {} +impl ::core::clone::Clone for FILE_STANDARD_INFO { + fn clone(&self) -> Self { + *self + } +} +pub const FILE_SUPERSEDE: NTCREATEFILE_CREATE_DISPOSITION = 0u32; +pub const FILE_SYNCHRONOUS_IO_ALERT: NTCREATEFILE_CREATE_OPTIONS = 16u32; +pub const FILE_SYNCHRONOUS_IO_NONALERT: NTCREATEFILE_CREATE_OPTIONS = 32u32; +pub const FILE_TRAVERSE: FILE_ACCESS_RIGHTS = 32u32; +pub type FILE_TYPE = u32; +pub const FILE_TYPE_CHAR: FILE_TYPE = 2u32; +pub const FILE_TYPE_DISK: FILE_TYPE = 1u32; +pub const FILE_TYPE_PIPE: FILE_TYPE = 3u32; +pub const FILE_TYPE_REMOTE: FILE_TYPE = 32768u32; +pub const FILE_TYPE_UNKNOWN: FILE_TYPE = 0u32; +pub const FILE_WRITE_ATTRIBUTES: FILE_ACCESS_RIGHTS = 256u32; +pub const FILE_WRITE_DATA: FILE_ACCESS_RIGHTS = 2u32; +pub const FILE_WRITE_EA: FILE_ACCESS_RIGHTS = 16u32; +pub const FILE_WRITE_THROUGH: NTCREATEFILE_CREATE_OPTIONS = 2u32; +pub const FIONBIO: i32 = -2147195266i32; +#[repr(C)] +#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] +pub struct FLOATING_SAVE_AREA { + pub ControlWord: u32, + pub StatusWord: u32, + pub TagWord: u32, + pub ErrorOffset: u32, + pub ErrorSelector: u32, + pub DataOffset: u32, + pub DataSelector: u32, + pub RegisterArea: [u8; 80], + pub Cr0NpxState: u32, +} +#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] +impl ::core::marker::Copy for FLOATING_SAVE_AREA {} +#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] +impl ::core::clone::Clone for FLOATING_SAVE_AREA { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "x86")] +pub struct FLOATING_SAVE_AREA { + pub ControlWord: u32, + pub StatusWord: u32, + pub TagWord: u32, + pub ErrorOffset: u32, + pub ErrorSelector: u32, + pub DataOffset: u32, + pub DataSelector: u32, + pub RegisterArea: [u8; 80], + pub Spare0: u32, +} +#[cfg(target_arch = "x86")] +impl ::core::marker::Copy for FLOATING_SAVE_AREA {} +#[cfg(target_arch = "x86")] +impl ::core::clone::Clone for FLOATING_SAVE_AREA { + fn clone(&self) -> Self { + *self + } +} +pub const FORMAT_MESSAGE_ALLOCATE_BUFFER: FORMAT_MESSAGE_OPTIONS = 256u32; +pub const FORMAT_MESSAGE_ARGUMENT_ARRAY: FORMAT_MESSAGE_OPTIONS = 8192u32; +pub const FORMAT_MESSAGE_FROM_HMODULE: FORMAT_MESSAGE_OPTIONS = 2048u32; +pub const FORMAT_MESSAGE_FROM_STRING: FORMAT_MESSAGE_OPTIONS = 1024u32; +pub const FORMAT_MESSAGE_FROM_SYSTEM: FORMAT_MESSAGE_OPTIONS = 4096u32; +pub const FORMAT_MESSAGE_IGNORE_INSERTS: FORMAT_MESSAGE_OPTIONS = 512u32; +pub type FORMAT_MESSAGE_OPTIONS = u32; +pub const FRS_ERR_SYSVOL_POPULATE_TIMEOUT: i32 = 8014i32; +pub const FSCTL_GET_REPARSE_POINT: u32 = 589992u32; +pub const FSCTL_SET_REPARSE_POINT: u32 = 589988u32; +pub const FileAlignmentInfo: FILE_INFO_BY_HANDLE_CLASS = 17i32; +pub const FileAllocationInfo: FILE_INFO_BY_HANDLE_CLASS = 5i32; +pub const FileAttributeTagInfo: FILE_INFO_BY_HANDLE_CLASS = 9i32; +pub const FileBasicInfo: FILE_INFO_BY_HANDLE_CLASS = 0i32; +pub const FileCaseSensitiveInfo: FILE_INFO_BY_HANDLE_CLASS = 23i32; +pub const FileCompressionInfo: FILE_INFO_BY_HANDLE_CLASS = 8i32; +pub const FileDispositionInfo: FILE_INFO_BY_HANDLE_CLASS = 4i32; +pub const FileDispositionInfoEx: FILE_INFO_BY_HANDLE_CLASS = 21i32; +pub const FileEndOfFileInfo: FILE_INFO_BY_HANDLE_CLASS = 6i32; +pub const FileFullDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 14i32; +pub const FileFullDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 15i32; +pub const FileIdBothDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 10i32; +pub const FileIdBothDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 11i32; +pub const FileIdExtdDirectoryInfo: FILE_INFO_BY_HANDLE_CLASS = 19i32; +pub const FileIdExtdDirectoryRestartInfo: FILE_INFO_BY_HANDLE_CLASS = 20i32; +pub const FileIdInfo: FILE_INFO_BY_HANDLE_CLASS = 18i32; +pub const FileIoPriorityHintInfo: FILE_INFO_BY_HANDLE_CLASS = 12i32; +pub const FileNameInfo: FILE_INFO_BY_HANDLE_CLASS = 2i32; +pub const FileNormalizedNameInfo: FILE_INFO_BY_HANDLE_CLASS = 24i32; +pub const FileRemoteProtocolInfo: FILE_INFO_BY_HANDLE_CLASS = 13i32; +pub const FileRenameInfo: FILE_INFO_BY_HANDLE_CLASS = 3i32; +pub const FileRenameInfoEx: FILE_INFO_BY_HANDLE_CLASS = 22i32; +pub const FileStandardInfo: FILE_INFO_BY_HANDLE_CLASS = 1i32; +pub const FileStorageInfo: FILE_INFO_BY_HANDLE_CLASS = 16i32; +pub const FileStreamInfo: FILE_INFO_BY_HANDLE_CLASS = 7i32; +pub type FindFileHandle = *mut ::core::ffi::c_void; +pub type GENERIC_ACCESS_RIGHTS = u32; +pub const GENERIC_ALL: GENERIC_ACCESS_RIGHTS = 268435456u32; +pub const GENERIC_EXECUTE: GENERIC_ACCESS_RIGHTS = 536870912u32; +pub const GENERIC_READ: GENERIC_ACCESS_RIGHTS = 2147483648u32; +pub const GENERIC_WRITE: GENERIC_ACCESS_RIGHTS = 1073741824u32; +pub type GETFINALPATHNAMEBYHANDLE_FLAGS = u32; +#[repr(C)] +pub struct GUID { + pub data1: u32, + pub data2: u16, + pub data3: u16, + pub data4: [u8; 8], +} +impl GUID { + pub const fn from_u128(uuid: u128) -> Self { + Self { + data1: (uuid >> 96) as u32, + data2: (uuid >> 80 & 0xffff) as u16, + data3: (uuid >> 64 & 0xffff) as u16, + data4: (uuid as u64).to_be_bytes(), + } + } +} +impl ::core::marker::Copy for GUID {} +impl ::core::clone::Clone for GUID { + fn clone(&self) -> Self { + *self + } +} +pub type HANDLE = *mut ::core::ffi::c_void; +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 HMODULE = *mut ::core::ffi::c_void; +pub type HRESULT = i32; +pub const IDLE_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 64u32; +#[repr(C)] +pub struct IN6_ADDR { + pub u: IN6_ADDR_0, +} +impl ::core::marker::Copy for IN6_ADDR {} +impl ::core::clone::Clone for IN6_ADDR { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union IN6_ADDR_0 { + pub Byte: [u8; 16], + pub Word: [u16; 8], +} +impl ::core::marker::Copy for IN6_ADDR_0 {} +impl ::core::clone::Clone for IN6_ADDR_0 { + fn clone(&self) -> Self { + *self + } +} +pub const INFINITE: u32 = 4294967295u32; +pub const INHERIT_CALLER_PRIORITY: PROCESS_CREATION_FLAGS = 131072u32; +pub const INHERIT_PARENT_AFFINITY: PROCESS_CREATION_FLAGS = 65536u32; +pub const INIT_ONCE_INIT_FAILED: u32 = 4u32; +pub const INVALID_FILE_ATTRIBUTES: u32 = 4294967295u32; +pub const INVALID_HANDLE_VALUE: HANDLE = ::core::ptr::invalid_mut(-1i32 as _); +pub const INVALID_SOCKET: SOCKET = -1i32 as _; +#[repr(C)] +pub struct IN_ADDR { + pub S_un: IN_ADDR_0, +} +impl ::core::marker::Copy for IN_ADDR {} +impl ::core::clone::Clone for IN_ADDR { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union IN_ADDR_0 { + pub S_un_b: IN_ADDR_0_0, + pub S_un_w: IN_ADDR_0_1, + pub S_addr: u32, +} +impl ::core::marker::Copy for IN_ADDR_0 {} +impl ::core::clone::Clone for IN_ADDR_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct IN_ADDR_0_0 { + pub s_b1: u8, + pub s_b2: u8, + pub s_b3: u8, + pub s_b4: u8, +} +impl ::core::marker::Copy for IN_ADDR_0_0 {} +impl ::core::clone::Clone for IN_ADDR_0_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct IN_ADDR_0_1 { + pub s_w1: u16, + pub s_w2: u16, +} +impl ::core::marker::Copy for IN_ADDR_0_1 {} +impl ::core::clone::Clone for IN_ADDR_0_1 { + fn clone(&self) -> Self { + *self + } +} +pub const IO_REPARSE_TAG_MOUNT_POINT: u32 = 2684354563u32; +pub const IO_REPARSE_TAG_SYMLINK: u32 = 2684354572u32; +#[repr(C)] +pub struct IO_STATUS_BLOCK { + pub Anonymous: IO_STATUS_BLOCK_0, + pub Information: usize, +} +impl ::core::marker::Copy for IO_STATUS_BLOCK {} +impl ::core::clone::Clone for IO_STATUS_BLOCK { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union IO_STATUS_BLOCK_0 { + pub Status: NTSTATUS, + pub Pointer: *mut ::core::ffi::c_void, +} +impl ::core::marker::Copy for IO_STATUS_BLOCK_0 {} +impl ::core::clone::Clone for IO_STATUS_BLOCK_0 { + fn clone(&self) -> Self { + *self + } +} +pub type IPPROTO = i32; +pub const IPPROTO_AH: IPPROTO = 51i32; +pub const IPPROTO_CBT: IPPROTO = 7i32; +pub const IPPROTO_DSTOPTS: IPPROTO = 60i32; +pub const IPPROTO_EGP: IPPROTO = 8i32; +pub const IPPROTO_ESP: IPPROTO = 50i32; +pub const IPPROTO_FRAGMENT: IPPROTO = 44i32; +pub const IPPROTO_GGP: IPPROTO = 3i32; +pub const IPPROTO_HOPOPTS: IPPROTO = 0i32; +pub const IPPROTO_ICLFXBM: IPPROTO = 78i32; +pub const IPPROTO_ICMP: IPPROTO = 1i32; +pub const IPPROTO_ICMPV6: IPPROTO = 58i32; +pub const IPPROTO_IDP: IPPROTO = 22i32; +pub const IPPROTO_IGMP: IPPROTO = 2i32; +pub const IPPROTO_IGP: IPPROTO = 9i32; +pub const IPPROTO_IP: IPPROTO = 0i32; +pub const IPPROTO_IPV4: IPPROTO = 4i32; +pub const IPPROTO_IPV6: IPPROTO = 41i32; +pub const IPPROTO_L2TP: IPPROTO = 115i32; +pub const IPPROTO_MAX: IPPROTO = 256i32; +pub const IPPROTO_ND: IPPROTO = 77i32; +pub const IPPROTO_NONE: IPPROTO = 59i32; +pub const IPPROTO_PGM: IPPROTO = 113i32; +pub const IPPROTO_PIM: IPPROTO = 103i32; +pub const IPPROTO_PUP: IPPROTO = 12i32; +pub const IPPROTO_RAW: IPPROTO = 255i32; +pub const IPPROTO_RDP: IPPROTO = 27i32; +pub const IPPROTO_RESERVED_IPSEC: IPPROTO = 258i32; +pub const IPPROTO_RESERVED_IPSECOFFLOAD: IPPROTO = 259i32; +pub const IPPROTO_RESERVED_MAX: IPPROTO = 261i32; +pub const IPPROTO_RESERVED_RAW: IPPROTO = 257i32; +pub const IPPROTO_RESERVED_WNV: IPPROTO = 260i32; +pub const IPPROTO_RM: IPPROTO = 113i32; +pub const IPPROTO_ROUTING: IPPROTO = 43i32; +pub const IPPROTO_SCTP: IPPROTO = 132i32; +pub const IPPROTO_ST: IPPROTO = 5i32; +pub const IPPROTO_TCP: IPPROTO = 6i32; +pub const IPPROTO_UDP: IPPROTO = 17i32; +pub const IPV6_ADD_MEMBERSHIP: i32 = 12i32; +pub const IPV6_DROP_MEMBERSHIP: i32 = 13i32; +#[repr(C)] +pub struct IPV6_MREQ { + pub ipv6mr_multiaddr: IN6_ADDR, + pub ipv6mr_interface: u32, +} +impl ::core::marker::Copy for IPV6_MREQ {} +impl ::core::clone::Clone for IPV6_MREQ { + fn clone(&self) -> Self { + *self + } +} +pub const IPV6_MULTICAST_LOOP: i32 = 11i32; +pub const IPV6_V6ONLY: i32 = 27i32; +pub const IP_ADD_MEMBERSHIP: i32 = 12i32; +pub const IP_DROP_MEMBERSHIP: i32 = 13i32; +#[repr(C)] +pub struct IP_MREQ { + pub imr_multiaddr: IN_ADDR, + pub imr_interface: IN_ADDR, +} +impl ::core::marker::Copy for IP_MREQ {} +impl ::core::clone::Clone for IP_MREQ { + fn clone(&self) -> Self { + *self + } +} +pub const IP_MULTICAST_LOOP: i32 = 11i32; +pub const IP_MULTICAST_TTL: i32 = 10i32; +pub const IP_TTL: i32 = 4i32; +#[repr(C)] +pub struct LINGER { + pub l_onoff: u16, + pub l_linger: u16, +} +impl ::core::marker::Copy for LINGER {} +impl ::core::clone::Clone for LINGER { + fn clone(&self) -> Self { + *self + } +} +pub type LPOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< + unsafe extern "system" fn( + dwerrorcode: u32, + dwnumberofbytestransfered: u32, + lpoverlapped: *mut OVERLAPPED, + ) -> (), +>; +pub type LPPROGRESS_ROUTINE = ::core::option::Option< + unsafe extern "system" fn( + totalfilesize: i64, + totalbytestransferred: i64, + streamsize: i64, + streambytestransferred: i64, + dwstreamnumber: u32, + dwcallbackreason: LPPROGRESS_ROUTINE_CALLBACK_REASON, + hsourcefile: HANDLE, + hdestinationfile: HANDLE, + lpdata: *const ::core::ffi::c_void, + ) -> u32, +>; +pub type LPPROGRESS_ROUTINE_CALLBACK_REASON = u32; +pub type LPTHREAD_START_ROUTINE = ::core::option::Option< + unsafe extern "system" fn(lpthreadparameter: *mut ::core::ffi::c_void) -> u32, +>; +pub type LPWSAOVERLAPPED_COMPLETION_ROUTINE = ::core::option::Option< + unsafe extern "system" fn( + dwerror: u32, + cbtransferred: u32, + lpoverlapped: *mut OVERLAPPED, + dwflags: u32, + ) -> (), +>; +#[repr(C)] +pub struct M128A { + pub Low: u64, + pub High: i64, +} +impl ::core::marker::Copy for M128A {} +impl ::core::clone::Clone for M128A { + fn clone(&self) -> Self { + *self + } +} +pub const MAXIMUM_REPARSE_DATA_BUFFER_SIZE: u32 = 16384u32; +pub const MAX_PATH: u32 = 260u32; +pub const MB_COMPOSITE: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 2u32; +pub const MB_ERR_INVALID_CHARS: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 8u32; +pub const MB_PRECOMPOSED: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 1u32; +pub const MB_USEGLYPHCHARS: MULTI_BYTE_TO_WIDE_CHAR_FLAGS = 4u32; +pub const MOVEFILE_COPY_ALLOWED: MOVE_FILE_FLAGS = 2u32; +pub const MOVEFILE_CREATE_HARDLINK: MOVE_FILE_FLAGS = 16u32; +pub const MOVEFILE_DELAY_UNTIL_REBOOT: MOVE_FILE_FLAGS = 4u32; +pub const MOVEFILE_FAIL_IF_NOT_TRACKABLE: MOVE_FILE_FLAGS = 32u32; +pub const MOVEFILE_REPLACE_EXISTING: MOVE_FILE_FLAGS = 1u32; +pub const MOVEFILE_WRITE_THROUGH: MOVE_FILE_FLAGS = 8u32; +pub type MOVE_FILE_FLAGS = u32; +pub const MSG_DONTROUTE: SEND_RECV_FLAGS = 4i32; +pub const MSG_OOB: SEND_RECV_FLAGS = 1i32; +pub const MSG_PEEK: SEND_RECV_FLAGS = 2i32; +pub const MSG_PUSH_IMMEDIATE: SEND_RECV_FLAGS = 32i32; +pub const MSG_WAITALL: SEND_RECV_FLAGS = 8i32; +pub type MULTI_BYTE_TO_WIDE_CHAR_FLAGS = u32; +pub const MaximumFileInfoByHandleClass: FILE_INFO_BY_HANDLE_CLASS = 25i32; +pub type NAMED_PIPE_MODE = u32; +pub const NORMAL_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 32u32; +pub const NO_ERROR: WIN32_ERROR = 0u32; +pub type NTCREATEFILE_CREATE_DISPOSITION = u32; +pub type NTCREATEFILE_CREATE_OPTIONS = u32; +pub type NTSTATUS = i32; +#[repr(C)] +pub struct OBJECT_ATTRIBUTES { + pub Length: u32, + pub RootDirectory: HANDLE, + pub ObjectName: *mut UNICODE_STRING, + pub Attributes: u32, + pub SecurityDescriptor: *mut ::core::ffi::c_void, + pub SecurityQualityOfService: *mut ::core::ffi::c_void, +} +impl ::core::marker::Copy for OBJECT_ATTRIBUTES {} +impl ::core::clone::Clone for OBJECT_ATTRIBUTES { + fn clone(&self) -> Self { + *self + } +} +pub const OBJ_DONT_REPARSE: i32 = 4096i32; +pub const OPEN_ALWAYS: FILE_CREATION_DISPOSITION = 4u32; +pub const OPEN_EXISTING: FILE_CREATION_DISPOSITION = 3u32; +#[repr(C)] +pub struct OVERLAPPED { + pub Internal: usize, + pub InternalHigh: usize, + pub Anonymous: OVERLAPPED_0, + pub hEvent: HANDLE, +} +impl ::core::marker::Copy for OVERLAPPED {} +impl ::core::clone::Clone for OVERLAPPED { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union OVERLAPPED_0 { + pub Anonymous: OVERLAPPED_0_0, + pub Pointer: *mut ::core::ffi::c_void, +} +impl ::core::marker::Copy for OVERLAPPED_0 {} +impl ::core::clone::Clone for OVERLAPPED_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct OVERLAPPED_0_0 { + pub Offset: u32, + pub OffsetHigh: u32, +} +impl ::core::marker::Copy for OVERLAPPED_0_0 {} +impl ::core::clone::Clone for OVERLAPPED_0_0 { + fn clone(&self) -> Self { + *self + } +} +pub type PCSTR = *const u8; +pub type PCWSTR = *const u16; +pub type PIO_APC_ROUTINE = ::core::option::Option< + unsafe extern "system" fn( + apccontext: *const ::core::ffi::c_void, + iostatusblock: *const IO_STATUS_BLOCK, + reserved: u32, + ) -> (), +>; +pub const PIPE_ACCEPT_REMOTE_CLIENTS: NAMED_PIPE_MODE = 0u32; +pub const PIPE_ACCESS_DUPLEX: FILE_FLAGS_AND_ATTRIBUTES = 3u32; +pub const PIPE_ACCESS_INBOUND: FILE_FLAGS_AND_ATTRIBUTES = 1u32; +pub const PIPE_ACCESS_OUTBOUND: FILE_FLAGS_AND_ATTRIBUTES = 2u32; +pub const PIPE_CLIENT_END: NAMED_PIPE_MODE = 0u32; +pub const PIPE_NOWAIT: NAMED_PIPE_MODE = 1u32; +pub const PIPE_READMODE_BYTE: NAMED_PIPE_MODE = 0u32; +pub const PIPE_READMODE_MESSAGE: NAMED_PIPE_MODE = 2u32; +pub const PIPE_REJECT_REMOTE_CLIENTS: NAMED_PIPE_MODE = 8u32; +pub const PIPE_SERVER_END: NAMED_PIPE_MODE = 1u32; +pub const PIPE_TYPE_BYTE: NAMED_PIPE_MODE = 0u32; +pub const PIPE_TYPE_MESSAGE: NAMED_PIPE_MODE = 4u32; +pub const PIPE_WAIT: NAMED_PIPE_MODE = 0u32; +pub type PROCESSOR_ARCHITECTURE = u16; +pub type PROCESS_CREATION_FLAGS = u32; +#[repr(C)] +pub struct PROCESS_INFORMATION { + pub hProcess: HANDLE, + pub hThread: HANDLE, + pub dwProcessId: u32, + pub dwThreadId: u32, +} +impl ::core::marker::Copy for PROCESS_INFORMATION {} +impl ::core::clone::Clone for PROCESS_INFORMATION { + fn clone(&self) -> Self { + *self + } +} +pub const PROCESS_MODE_BACKGROUND_BEGIN: PROCESS_CREATION_FLAGS = 1048576u32; +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 type PSTR = *mut u8; +pub type PVECTORED_EXCEPTION_HANDLER = ::core::option::Option< + unsafe extern "system" fn(exceptioninfo: *mut EXCEPTION_POINTERS) -> i32, +>; +pub type PWSTR = *mut u16; +pub const READ_CONTROL: FILE_ACCESS_RIGHTS = 131072u32; +pub const REALTIME_PRIORITY_CLASS: PROCESS_CREATION_FLAGS = 256u32; +#[repr(C)] +pub struct RTL_CONDITION_VARIABLE { + pub Ptr: *mut ::core::ffi::c_void, +} +impl ::core::marker::Copy for RTL_CONDITION_VARIABLE {} +impl ::core::clone::Clone for RTL_CONDITION_VARIABLE { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union RTL_RUN_ONCE { + pub Ptr: *mut ::core::ffi::c_void, +} +impl ::core::marker::Copy for RTL_RUN_ONCE {} +impl ::core::clone::Clone for RTL_RUN_ONCE { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct RTL_SRWLOCK { + pub Ptr: *mut ::core::ffi::c_void, +} +impl ::core::marker::Copy for RTL_SRWLOCK {} +impl ::core::clone::Clone for RTL_SRWLOCK { + fn clone(&self) -> Self { + *self + } +} +pub const SD_BOTH: WINSOCK_SHUTDOWN_HOW = 2i32; +pub const SD_RECEIVE: WINSOCK_SHUTDOWN_HOW = 0i32; +pub const SD_SEND: WINSOCK_SHUTDOWN_HOW = 1i32; +pub const SECURITY_ANONYMOUS: FILE_FLAGS_AND_ATTRIBUTES = 0u32; +#[repr(C)] +pub struct SECURITY_ATTRIBUTES { + pub nLength: u32, + pub lpSecurityDescriptor: *mut ::core::ffi::c_void, + pub bInheritHandle: BOOL, +} +impl ::core::marker::Copy for SECURITY_ATTRIBUTES {} +impl ::core::clone::Clone for SECURITY_ATTRIBUTES { + fn clone(&self) -> Self { + *self + } +} +pub const SECURITY_CONTEXT_TRACKING: FILE_FLAGS_AND_ATTRIBUTES = 262144u32; +pub const SECURITY_DELEGATION: FILE_FLAGS_AND_ATTRIBUTES = 196608u32; +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 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; +pub type SET_FILE_POINTER_MOVE_METHOD = u32; +#[repr(C)] +pub struct SOCKADDR { + pub sa_family: ADDRESS_FAMILY, + pub sa_data: [u8; 14], +} +impl ::core::marker::Copy for SOCKADDR {} +impl ::core::clone::Clone for SOCKADDR { + fn clone(&self) -> Self { + *self + } +} +#[cfg(target_pointer_width = "32")] +pub type SOCKET = u32; +#[cfg(target_pointer_width = "64")] +pub type SOCKET = u64; +pub const SOCKET_ERROR: i32 = -1i32; +pub const SOCK_DGRAM: WINSOCK_SOCKET_TYPE = 2i32; +pub const SOCK_RAW: WINSOCK_SOCKET_TYPE = 3i32; +pub const SOCK_RDM: WINSOCK_SOCKET_TYPE = 4i32; +pub const SOCK_SEQPACKET: WINSOCK_SOCKET_TYPE = 5i32; +pub const SOCK_STREAM: WINSOCK_SOCKET_TYPE = 1i32; +pub const SOL_SOCKET: i32 = 65535i32; +pub const SO_BROADCAST: i32 = 32i32; +pub const SO_ERROR: i32 = 4103i32; +pub const SO_LINGER: i32 = 128i32; +pub const SO_RCVTIMEO: i32 = 4102i32; +pub const SO_SNDTIMEO: i32 = 4101i32; +pub const SPECIFIC_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 65535u32; +pub const STACK_SIZE_PARAM_IS_A_RESERVATION: THREAD_CREATION_FLAGS = 65536u32; +pub const STANDARD_RIGHTS_ALL: FILE_ACCESS_RIGHTS = 2031616u32; +pub const STANDARD_RIGHTS_EXECUTE: FILE_ACCESS_RIGHTS = 131072u32; +pub const STANDARD_RIGHTS_READ: FILE_ACCESS_RIGHTS = 131072u32; +pub const STANDARD_RIGHTS_REQUIRED: FILE_ACCESS_RIGHTS = 983040u32; +pub const STANDARD_RIGHTS_WRITE: FILE_ACCESS_RIGHTS = 131072u32; +pub const STARTF_FORCEOFFFEEDBACK: STARTUPINFOW_FLAGS = 128u32; +pub const STARTF_FORCEONFEEDBACK: STARTUPINFOW_FLAGS = 64u32; +pub const STARTF_PREVENTPINNING: STARTUPINFOW_FLAGS = 8192u32; +pub const STARTF_RUNFULLSCREEN: STARTUPINFOW_FLAGS = 32u32; +pub const STARTF_TITLEISAPPID: STARTUPINFOW_FLAGS = 4096u32; +pub const STARTF_TITLEISLINKNAME: STARTUPINFOW_FLAGS = 2048u32; +pub const STARTF_UNTRUSTEDSOURCE: STARTUPINFOW_FLAGS = 32768u32; +pub const STARTF_USECOUNTCHARS: STARTUPINFOW_FLAGS = 8u32; +pub const STARTF_USEFILLATTRIBUTE: STARTUPINFOW_FLAGS = 16u32; +pub const STARTF_USEHOTKEY: STARTUPINFOW_FLAGS = 512u32; +pub const STARTF_USEPOSITION: STARTUPINFOW_FLAGS = 4u32; +pub const STARTF_USESHOWWINDOW: STARTUPINFOW_FLAGS = 1u32; +pub const STARTF_USESIZE: STARTUPINFOW_FLAGS = 2u32; +pub const STARTF_USESTDHANDLES: STARTUPINFOW_FLAGS = 256u32; +#[repr(C)] +pub struct STARTUPINFOW { + pub cb: u32, + pub lpReserved: PWSTR, + pub lpDesktop: PWSTR, + pub lpTitle: PWSTR, + pub dwX: u32, + pub dwY: u32, + pub dwXSize: u32, + pub dwYSize: u32, + pub dwXCountChars: u32, + pub dwYCountChars: u32, + pub dwFillAttribute: u32, + pub dwFlags: STARTUPINFOW_FLAGS, + pub wShowWindow: u16, + pub cbReserved2: u16, + pub lpReserved2: *mut u8, + pub hStdInput: HANDLE, + pub hStdOutput: HANDLE, + pub hStdError: HANDLE, +} +impl ::core::marker::Copy for STARTUPINFOW {} +impl ::core::clone::Clone for STARTUPINFOW { + fn clone(&self) -> Self { + *self + } +} +pub type STARTUPINFOW_FLAGS = u32; +pub const STATUS_DELETE_PENDING: NTSTATUS = -1073741738i32; +pub const STATUS_END_OF_FILE: NTSTATUS = -1073741807i32; +pub const STATUS_INVALID_PARAMETER: NTSTATUS = -1073741811i32; +pub const STATUS_PENDING: NTSTATUS = 259i32; +pub const STATUS_SUCCESS: NTSTATUS = 0i32; +pub const STD_ERROR_HANDLE: STD_HANDLE = 4294967284u32; +pub type STD_HANDLE = u32; +pub const STD_INPUT_HANDLE: STD_HANDLE = 4294967286u32; +pub const STD_OUTPUT_HANDLE: STD_HANDLE = 4294967285u32; +pub type SYMBOLIC_LINK_FLAGS = u32; +pub const SYMBOLIC_LINK_FLAG_ALLOW_UNPRIVILEGED_CREATE: SYMBOLIC_LINK_FLAGS = 2u32; +pub const SYMBOLIC_LINK_FLAG_DIRECTORY: SYMBOLIC_LINK_FLAGS = 1u32; +pub const SYMLINK_FLAG_RELATIVE: u32 = 1u32; +pub const SYNCHRONIZE: FILE_ACCESS_RIGHTS = 1048576u32; +#[repr(C)] +pub struct SYSTEM_INFO { + pub Anonymous: SYSTEM_INFO_0, + pub dwPageSize: u32, + pub lpMinimumApplicationAddress: *mut ::core::ffi::c_void, + pub lpMaximumApplicationAddress: *mut ::core::ffi::c_void, + pub dwActiveProcessorMask: usize, + pub dwNumberOfProcessors: u32, + pub dwProcessorType: u32, + pub dwAllocationGranularity: u32, + pub wProcessorLevel: u16, + pub wProcessorRevision: u16, +} +impl ::core::marker::Copy for SYSTEM_INFO {} +impl ::core::clone::Clone for SYSTEM_INFO { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub union SYSTEM_INFO_0 { + pub dwOemId: u32, + pub Anonymous: SYSTEM_INFO_0_0, +} +impl ::core::marker::Copy for SYSTEM_INFO_0 {} +impl ::core::clone::Clone for SYSTEM_INFO_0 { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct SYSTEM_INFO_0_0 { + pub wProcessorArchitecture: PROCESSOR_ARCHITECTURE, + pub wReserved: u16, +} +impl ::core::marker::Copy for SYSTEM_INFO_0_0 {} +impl ::core::clone::Clone for SYSTEM_INFO_0_0 { + fn clone(&self) -> Self { + *self + } +} +pub const TCP_NODELAY: i32 = 1i32; +pub const THREAD_CREATE_RUN_IMMEDIATELY: THREAD_CREATION_FLAGS = 0u32; +pub const THREAD_CREATE_SUSPENDED: THREAD_CREATION_FLAGS = 4u32; +pub type THREAD_CREATION_FLAGS = u32; +#[repr(C)] +pub struct TIMEVAL { + pub tv_sec: i32, + pub tv_usec: i32, +} +impl ::core::marker::Copy for TIMEVAL {} +impl ::core::clone::Clone for TIMEVAL { + fn clone(&self) -> Self { + *self + } +} +pub const TLS_OUT_OF_INDEXES: u32 = 4294967295u32; +pub type TOKEN_ACCESS_MASK = u32; +pub const TOKEN_ACCESS_PSEUDO_HANDLE: TOKEN_ACCESS_MASK = 24u32; +pub const TOKEN_ACCESS_PSEUDO_HANDLE_WIN8: TOKEN_ACCESS_MASK = 24u32; +pub const TOKEN_ACCESS_SYSTEM_SECURITY: TOKEN_ACCESS_MASK = 16777216u32; +pub const TOKEN_ADJUST_DEFAULT: TOKEN_ACCESS_MASK = 128u32; +pub const TOKEN_ADJUST_GROUPS: TOKEN_ACCESS_MASK = 64u32; +pub const TOKEN_ADJUST_PRIVILEGES: TOKEN_ACCESS_MASK = 32u32; +pub const TOKEN_ADJUST_SESSIONID: TOKEN_ACCESS_MASK = 256u32; +pub const TOKEN_ALL_ACCESS: TOKEN_ACCESS_MASK = 983551u32; +pub const TOKEN_ASSIGN_PRIMARY: TOKEN_ACCESS_MASK = 1u32; +pub const TOKEN_DELETE: TOKEN_ACCESS_MASK = 65536u32; +pub const TOKEN_DUPLICATE: TOKEN_ACCESS_MASK = 2u32; +pub const TOKEN_EXECUTE: TOKEN_ACCESS_MASK = 131072u32; +pub const TOKEN_IMPERSONATE: TOKEN_ACCESS_MASK = 4u32; +pub const TOKEN_QUERY: TOKEN_ACCESS_MASK = 8u32; +pub const TOKEN_QUERY_SOURCE: TOKEN_ACCESS_MASK = 16u32; +pub const TOKEN_READ: TOKEN_ACCESS_MASK = 131080u32; +pub const TOKEN_READ_CONTROL: TOKEN_ACCESS_MASK = 131072u32; +pub const TOKEN_TRUST_CONSTRAINT_MASK: TOKEN_ACCESS_MASK = 131096u32; +pub const TOKEN_WRITE: TOKEN_ACCESS_MASK = 131296u32; +pub const TOKEN_WRITE_DAC: TOKEN_ACCESS_MASK = 262144u32; +pub const TOKEN_WRITE_OWNER: TOKEN_ACCESS_MASK = 524288u32; +pub const TRUE: BOOL = 1i32; +pub const TRUNCATE_EXISTING: FILE_CREATION_DISPOSITION = 5u32; +#[repr(C)] +pub struct UNICODE_STRING { + pub Length: u16, + pub MaximumLength: u16, + pub Buffer: PWSTR, +} +impl ::core::marker::Copy for UNICODE_STRING {} +impl ::core::clone::Clone for UNICODE_STRING { + fn clone(&self) -> Self { + *self + } +} +pub const VOLUME_NAME_DOS: GETFINALPATHNAMEBYHANDLE_FLAGS = 0u32; +pub const VOLUME_NAME_GUID: GETFINALPATHNAMEBYHANDLE_FLAGS = 1u32; +pub const VOLUME_NAME_NONE: GETFINALPATHNAMEBYHANDLE_FLAGS = 4u32; +pub const WAIT_ABANDONED: WIN32_ERROR = 128u32; +pub const WAIT_ABANDONED_0: WIN32_ERROR = 128u32; +pub const WAIT_FAILED: WIN32_ERROR = 4294967295u32; +pub const WAIT_IO_COMPLETION: WIN32_ERROR = 192u32; +pub const WAIT_OBJECT_0: WIN32_ERROR = 0u32; +pub const WAIT_TIMEOUT: WIN32_ERROR = 258u32; +pub const WC_ERR_INVALID_CHARS: u32 = 128u32; +pub type WIN32_ERROR = u32; +#[repr(C)] +pub struct WIN32_FIND_DATAW { + pub dwFileAttributes: u32, + pub ftCreationTime: FILETIME, + pub ftLastAccessTime: FILETIME, + pub ftLastWriteTime: FILETIME, + pub nFileSizeHigh: u32, + pub nFileSizeLow: u32, + pub dwReserved0: u32, + pub dwReserved1: u32, + pub cFileName: [u16; 260], + pub cAlternateFileName: [u16; 14], +} +impl ::core::marker::Copy for WIN32_FIND_DATAW {} +impl ::core::clone::Clone for WIN32_FIND_DATAW { + fn clone(&self) -> Self { + *self + } +} +pub type WINSOCK_SHUTDOWN_HOW = i32; +pub type WINSOCK_SOCKET_TYPE = i32; +pub const WRITE_DAC: FILE_ACCESS_RIGHTS = 262144u32; +pub const WRITE_OWNER: FILE_ACCESS_RIGHTS = 524288u32; +pub const WSABASEERR: WSA_ERROR = 10000i32; +#[repr(C)] +pub struct WSABUF { + pub len: u32, + pub buf: PSTR, +} +impl ::core::marker::Copy for WSABUF {} +impl ::core::clone::Clone for WSABUF { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] +pub struct WSADATA { + pub wVersion: u16, + pub wHighVersion: u16, + pub iMaxSockets: u16, + pub iMaxUdpDg: u16, + pub lpVendorInfo: PSTR, + pub szDescription: [u8; 257], + pub szSystemStatus: [u8; 129], +} +#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] +impl ::core::marker::Copy for WSADATA {} +#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] +impl ::core::clone::Clone for WSADATA { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "x86")] +pub struct WSADATA { + pub wVersion: u16, + pub wHighVersion: u16, + pub szDescription: [u8; 257], + pub szSystemStatus: [u8; 129], + pub iMaxSockets: u16, + pub iMaxUdpDg: u16, + pub lpVendorInfo: PSTR, +} +#[cfg(target_arch = "x86")] +impl ::core::marker::Copy for WSADATA {} +#[cfg(target_arch = "x86")] +impl ::core::clone::Clone for WSADATA { + fn clone(&self) -> Self { + *self + } +} +pub const WSAEACCES: WSA_ERROR = 10013i32; +pub const WSAEADDRINUSE: WSA_ERROR = 10048i32; +pub const WSAEADDRNOTAVAIL: WSA_ERROR = 10049i32; +pub const WSAEAFNOSUPPORT: WSA_ERROR = 10047i32; +pub const WSAEALREADY: WSA_ERROR = 10037i32; +pub const WSAEBADF: WSA_ERROR = 10009i32; +pub const WSAECANCELLED: WSA_ERROR = 10103i32; +pub const WSAECONNABORTED: WSA_ERROR = 10053i32; +pub const WSAECONNREFUSED: WSA_ERROR = 10061i32; +pub const WSAECONNRESET: WSA_ERROR = 10054i32; +pub const WSAEDESTADDRREQ: WSA_ERROR = 10039i32; +pub const WSAEDISCON: WSA_ERROR = 10101i32; +pub const WSAEDQUOT: WSA_ERROR = 10069i32; +pub const WSAEFAULT: WSA_ERROR = 10014i32; +pub const WSAEHOSTDOWN: WSA_ERROR = 10064i32; +pub const WSAEHOSTUNREACH: WSA_ERROR = 10065i32; +pub const WSAEINPROGRESS: WSA_ERROR = 10036i32; +pub const WSAEINTR: WSA_ERROR = 10004i32; +pub const WSAEINVAL: WSA_ERROR = 10022i32; +pub const WSAEINVALIDPROCTABLE: WSA_ERROR = 10104i32; +pub const WSAEINVALIDPROVIDER: WSA_ERROR = 10105i32; +pub const WSAEISCONN: WSA_ERROR = 10056i32; +pub const WSAELOOP: WSA_ERROR = 10062i32; +pub const WSAEMFILE: WSA_ERROR = 10024i32; +pub const WSAEMSGSIZE: WSA_ERROR = 10040i32; +pub const WSAENAMETOOLONG: WSA_ERROR = 10063i32; +pub const WSAENETDOWN: WSA_ERROR = 10050i32; +pub const WSAENETRESET: WSA_ERROR = 10052i32; +pub const WSAENETUNREACH: WSA_ERROR = 10051i32; +pub const WSAENOBUFS: WSA_ERROR = 10055i32; +pub const WSAENOMORE: WSA_ERROR = 10102i32; +pub const WSAENOPROTOOPT: WSA_ERROR = 10042i32; +pub const WSAENOTCONN: WSA_ERROR = 10057i32; +pub const WSAENOTEMPTY: WSA_ERROR = 10066i32; +pub const WSAENOTSOCK: WSA_ERROR = 10038i32; +pub const WSAEOPNOTSUPP: WSA_ERROR = 10045i32; +pub const WSAEPFNOSUPPORT: WSA_ERROR = 10046i32; +pub const WSAEPROCLIM: WSA_ERROR = 10067i32; +pub const WSAEPROTONOSUPPORT: WSA_ERROR = 10043i32; +pub const WSAEPROTOTYPE: WSA_ERROR = 10041i32; +pub const WSAEPROVIDERFAILEDINIT: WSA_ERROR = 10106i32; +pub const WSAEREFUSED: WSA_ERROR = 10112i32; +pub const WSAEREMOTE: WSA_ERROR = 10071i32; +pub const WSAESHUTDOWN: WSA_ERROR = 10058i32; +pub const WSAESOCKTNOSUPPORT: WSA_ERROR = 10044i32; +pub const WSAESTALE: WSA_ERROR = 10070i32; +pub const WSAETIMEDOUT: WSA_ERROR = 10060i32; +pub const WSAETOOMANYREFS: WSA_ERROR = 10059i32; +pub const WSAEUSERS: WSA_ERROR = 10068i32; +pub const WSAEWOULDBLOCK: WSA_ERROR = 10035i32; +pub const WSAHOST_NOT_FOUND: WSA_ERROR = 11001i32; +pub const WSANOTINITIALISED: WSA_ERROR = 10093i32; +pub const WSANO_DATA: WSA_ERROR = 11004i32; +pub const WSANO_RECOVERY: WSA_ERROR = 11003i32; +#[repr(C)] +pub struct WSAPROTOCOLCHAIN { + pub ChainLen: i32, + pub ChainEntries: [u32; 7], +} +impl ::core::marker::Copy for WSAPROTOCOLCHAIN {} +impl ::core::clone::Clone for WSAPROTOCOLCHAIN { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +pub struct WSAPROTOCOL_INFOW { + pub dwServiceFlags1: u32, + pub dwServiceFlags2: u32, + pub dwServiceFlags3: u32, + pub dwServiceFlags4: u32, + pub dwProviderFlags: u32, + pub ProviderId: GUID, + pub dwCatalogEntryId: u32, + pub ProtocolChain: WSAPROTOCOLCHAIN, + pub iVersion: i32, + pub iAddressFamily: i32, + pub iMaxSockAddr: i32, + pub iMinSockAddr: i32, + pub iSocketType: i32, + pub iProtocol: i32, + pub iProtocolMaxOffset: i32, + pub iNetworkByteOrder: i32, + pub iSecurityScheme: i32, + pub dwMessageSize: u32, + pub dwProviderReserved: u32, + pub szProtocol: [u16; 256], +} +impl ::core::marker::Copy for WSAPROTOCOL_INFOW {} +impl ::core::clone::Clone for WSAPROTOCOL_INFOW { + fn clone(&self) -> Self { + *self + } +} +pub const WSASERVICE_NOT_FOUND: WSA_ERROR = 10108i32; +pub const WSASYSCALLFAILURE: WSA_ERROR = 10107i32; +pub const WSASYSNOTREADY: WSA_ERROR = 10091i32; +pub const WSATRY_AGAIN: WSA_ERROR = 11002i32; +pub const WSATYPE_NOT_FOUND: WSA_ERROR = 10109i32; +pub const WSAVERNOTSUPPORTED: WSA_ERROR = 10092i32; +pub type WSA_ERROR = i32; +pub const WSA_E_CANCELLED: WSA_ERROR = 10111i32; +pub const WSA_E_NO_MORE: WSA_ERROR = 10110i32; +pub const WSA_FLAG_NO_HANDLE_INHERIT: u32 = 128u32; +pub const WSA_FLAG_OVERLAPPED: u32 = 1u32; +pub const WSA_INVALID_HANDLE: WSA_ERROR = 6i32; +pub const WSA_INVALID_PARAMETER: WSA_ERROR = 87i32; +pub const WSA_IO_INCOMPLETE: WSA_ERROR = 996i32; +pub const WSA_IO_PENDING: WSA_ERROR = 997i32; +pub const WSA_IPSEC_NAME_POLICY_ERROR: WSA_ERROR = 11033i32; +pub const WSA_NOT_ENOUGH_MEMORY: WSA_ERROR = 8i32; +pub const WSA_OPERATION_ABORTED: WSA_ERROR = 995i32; +pub const WSA_QOS_ADMISSION_FAILURE: WSA_ERROR = 11010i32; +pub const WSA_QOS_BAD_OBJECT: WSA_ERROR = 11013i32; +pub const WSA_QOS_BAD_STYLE: WSA_ERROR = 11012i32; +pub const WSA_QOS_EFILTERCOUNT: WSA_ERROR = 11021i32; +pub const WSA_QOS_EFILTERSTYLE: WSA_ERROR = 11019i32; +pub const WSA_QOS_EFILTERTYPE: WSA_ERROR = 11020i32; +pub const WSA_QOS_EFLOWCOUNT: WSA_ERROR = 11023i32; +pub const WSA_QOS_EFLOWDESC: WSA_ERROR = 11026i32; +pub const WSA_QOS_EFLOWSPEC: WSA_ERROR = 11017i32; +pub const WSA_QOS_EOBJLENGTH: WSA_ERROR = 11022i32; +pub const WSA_QOS_EPOLICYOBJ: WSA_ERROR = 11025i32; +pub const WSA_QOS_EPROVSPECBUF: WSA_ERROR = 11018i32; +pub const WSA_QOS_EPSFILTERSPEC: WSA_ERROR = 11028i32; +pub const WSA_QOS_EPSFLOWSPEC: WSA_ERROR = 11027i32; +pub const WSA_QOS_ESDMODEOBJ: WSA_ERROR = 11029i32; +pub const WSA_QOS_ESERVICETYPE: WSA_ERROR = 11016i32; +pub const WSA_QOS_ESHAPERATEOBJ: WSA_ERROR = 11030i32; +pub const WSA_QOS_EUNKOWNPSOBJ: WSA_ERROR = 11024i32; +pub const WSA_QOS_GENERIC_ERROR: WSA_ERROR = 11015i32; +pub const WSA_QOS_NO_RECEIVERS: WSA_ERROR = 11008i32; +pub const WSA_QOS_NO_SENDERS: WSA_ERROR = 11007i32; +pub const WSA_QOS_POLICY_FAILURE: WSA_ERROR = 11011i32; +pub const WSA_QOS_RECEIVERS: WSA_ERROR = 11005i32; +pub const WSA_QOS_REQUEST_CONFIRMED: WSA_ERROR = 11009i32; +pub const WSA_QOS_RESERVED_PETYPE: WSA_ERROR = 11031i32; +pub const WSA_QOS_SENDERS: WSA_ERROR = 11006i32; +pub const WSA_QOS_TRAFFIC_CTRL_ERROR: WSA_ERROR = 11014i32; +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 = "x86_64"))] +pub struct XSAVE_FORMAT { + pub ControlWord: u16, + pub StatusWord: u16, + pub TagWord: u8, + pub Reserved1: u8, + pub ErrorOpcode: u16, + pub ErrorOffset: u32, + pub ErrorSelector: u16, + pub Reserved2: u16, + pub DataOffset: u32, + pub DataSelector: u16, + pub Reserved3: u16, + pub MxCsr: u32, + pub MxCsr_Mask: u32, + pub FloatRegisters: [M128A; 8], + pub XmmRegisters: [M128A; 16], + pub Reserved4: [u8; 96], +} +#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] +impl ::core::marker::Copy for XSAVE_FORMAT {} +#[cfg(any(target_arch = "aarch64", target_arch = "x86_64"))] +impl ::core::clone::Clone for XSAVE_FORMAT { + fn clone(&self) -> Self { + *self + } +} +#[repr(C)] +#[cfg(target_arch = "x86")] +pub struct XSAVE_FORMAT { + pub ControlWord: u16, + pub StatusWord: u16, + pub TagWord: u8, + pub Reserved1: u8, + pub ErrorOpcode: u16, + pub ErrorOffset: u32, + pub ErrorSelector: u16, + pub Reserved2: u16, + pub DataOffset: u32, + pub DataSelector: u16, + pub Reserved3: u16, + pub MxCsr: u32, + pub MxCsr_Mask: u32, + pub FloatRegisters: [M128A; 8], + pub XmmRegisters: [M128A; 8], + pub Reserved4: [u8; 224], +} +#[cfg(target_arch = "x86")] +impl ::core::marker::Copy for XSAVE_FORMAT {} +#[cfg(target_arch = "x86")] +impl ::core::clone::Clone for XSAVE_FORMAT { + fn clone(&self) -> Self { + *self + } +} From 3ffb27ff89db780e88abe829783565a7122be1c5 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Thu, 6 Apr 2023 17:27:47 +0100 Subject: [PATCH 36/97] Use new bindings --- library/std/src/os/windows/io/socket.rs | 2 +- library/std/src/sys/windows/compat.rs | 16 +++++--- library/std/src/sys/windows/fs.rs | 39 ++++++++++++------- library/std/src/sys/windows/handle.rs | 6 +-- library/std/src/sys/windows/io.rs | 7 +--- library/std/src/sys/windows/net.rs | 4 +- library/std/src/sys/windows/pipe.rs | 2 +- library/std/src/sys/windows/process.rs | 10 ++--- library/std/src/sys/windows/rand.rs | 6 ++- library/std/src/sys/windows/stack_overflow.rs | 4 +- library/std/src/sys/windows/stdio.rs | 22 +++++------ library/std/src/sys/windows/thread.rs | 5 ++- 12 files changed, 70 insertions(+), 53 deletions(-) diff --git a/library/std/src/os/windows/io/socket.rs b/library/std/src/os/windows/io/socket.rs index b6bd0f9e12bd..ce34cd1a9bfb 100644 --- a/library/std/src/os/windows/io/socket.rs +++ b/library/std/src/os/windows/io/socket.rs @@ -110,7 +110,7 @@ impl BorrowedSocket<'_> { /// object as the existing `BorrowedSocket` instance. #[stable(feature = "io_safety", since = "1.63.0")] pub fn try_clone_to_owned(&self) -> io::Result { - let mut info = unsafe { mem::zeroed::() }; + let mut info = unsafe { mem::zeroed::() }; let result = unsafe { c::WSADuplicateSocketW(self.as_raw_socket(), c::GetCurrentProcessId(), &mut info) }; diff --git a/library/std/src/sys/windows/compat.rs b/library/std/src/sys/windows/compat.rs index 7dff81ecb8dd..4fe95d41116b 100644 --- a/library/std/src/sys/windows/compat.rs +++ b/library/std/src/sys/windows/compat.rs @@ -114,17 +114,20 @@ impl Module { /// (e.g. kernel32 and ntdll). pub unsafe fn new(name: &CStr) -> Option { // SAFETY: A CStr is always null terminated. - let module = c::GetModuleHandleA(name.as_ptr()); + let module = c::GetModuleHandleA(name.as_ptr().cast::()); NonNull::new(module).map(Self) } // Try to get the address of a function. pub fn proc_address(self, name: &CStr) -> Option> { - // SAFETY: - // `self.0` will always be a valid module. - // A CStr is always null terminated. - let proc = unsafe { c::GetProcAddress(self.0.as_ptr(), name.as_ptr()) }; - NonNull::new(proc) + unsafe { + // SAFETY: + // `self.0` will always be a valid module. + // A CStr is always null terminated. + let proc = c::GetProcAddress(self.0.as_ptr(), name.as_ptr().cast::()); + // SAFETY: `GetProcAddress` returns None on null. + proc.map(|p| NonNull::new_unchecked(p as *mut c_void)) + } } } @@ -199,6 +202,7 @@ macro_rules! compat_fn_optional { )+) => ( $( pub mod $symbol { + #[allow(unused_imports)] use super::*; use crate::ffi::c_void; use crate::mem; diff --git a/library/std/src/sys/windows/fs.rs b/library/std/src/sys/windows/fs.rs index fe052c8281b5..ce427766d173 100644 --- a/library/std/src/sys/windows/fs.rs +++ b/library/std/src/sys/windows/fs.rs @@ -89,6 +89,12 @@ pub struct FileTimes { accessed: Option, modified: Option, } +impl core::fmt::Debug for c::FILETIME { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let time = ((self.dwHighDateTime as u64) << 32) | self.dwLowDateTime as u64; + f.debug_tuple("FILETIME").field(&time).finish() + } +} #[derive(Debug)] pub struct DirBuilder; @@ -290,6 +296,7 @@ impl File { ptr::null_mut(), ) }; + let handle = unsafe { HandleOrInvalid::from_raw_handle(handle) }; if let Ok(handle) = handle.try_into() { Ok(File { handle: Handle::from_inner(handle) }) } else { @@ -501,7 +508,8 @@ impl File { } fn readlink(&self) -> io::Result { - let mut space = Align8([MaybeUninit::::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); + let mut space = + Align8([MaybeUninit::::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize]); let (_bytes, buf) = self.reparse_point(&mut space)?; unsafe { let (path_buffer, subst_off, subst_len, relative) = match (*buf).ReparseTag { @@ -589,7 +597,11 @@ impl File { )); } cvt(unsafe { - c::SetFileTime(self.as_handle(), None, times.accessed.as_ref(), times.modified.as_ref()) + let accessed = + times.accessed.as_ref().map(|a| a as *const c::FILETIME).unwrap_or(ptr::null()); + let modified = + times.modified.as_ref().map(|a| a as *const c::FILETIME).unwrap_or(ptr::null()); + c::SetFileTime(self.as_raw_handle(), ptr::null_mut(), accessed, modified) })?; Ok(()) } @@ -618,9 +630,9 @@ impl File { /// then errors will be `ERROR_NOT_SUPPORTED` or `ERROR_INVALID_PARAMETER`. fn posix_delete(&self) -> io::Result<()> { let mut info = c::FILE_DISPOSITION_INFO_EX { - Flags: c::FILE_DISPOSITION_DELETE - | c::FILE_DISPOSITION_POSIX_SEMANTICS - | c::FILE_DISPOSITION_IGNORE_READONLY_ATTRIBUTE, + Flags: c::FILE_DISPOSITION_FLAG_DELETE + | c::FILE_DISPOSITION_FLAG_POSIX_SEMANTICS + | c::FILE_DISPOSITION_FLAG_IGNORE_READONLY_ATTRIBUTE, }; let size = mem::size_of_val(&info); cvt(unsafe { @@ -791,15 +803,15 @@ fn open_link_no_reparse(parent: &File, name: &[u16], access: u32) -> io::Result< // See https://docs.microsoft.com/en-us/windows/win32/api/winternl/nf-winternl-ntcreatefile unsafe { let mut handle = ptr::null_mut(); - let mut io_status = c::IO_STATUS_BLOCK::default(); - let name_str = c::UNICODE_STRING::from_ref(name); + let mut io_status = c::IO_STATUS_BLOCK::PENDING; + let mut name_str = c::UNICODE_STRING::from_ref(name); use crate::sync::atomic::{AtomicU32, Ordering}; // The `OBJ_DONT_REPARSE` attribute ensures that we haven't been // tricked into following a symlink. However, it may not be available in // earlier versions of Windows. static ATTRIBUTES: AtomicU32 = AtomicU32::new(c::OBJ_DONT_REPARSE); - let object = c::OBJECT_ATTRIBUTES { - ObjectName: &name_str, + let mut object = c::OBJECT_ATTRIBUTES { + ObjectName: &mut name_str, RootDirectory: parent.as_raw_handle(), Attributes: ATTRIBUTES.load(Ordering::Relaxed), ..c::OBJECT_ATTRIBUTES::default() @@ -807,7 +819,7 @@ fn open_link_no_reparse(parent: &File, name: &[u16], access: u32) -> io::Result< let status = c::NtCreateFile( &mut handle, access, - &object, + &mut object, &mut io_status, crate::ptr::null_mut(), 0, @@ -1368,7 +1380,7 @@ pub fn copy(from: &Path, to: &Path) -> io::Result { _dwCallbackReason: c::DWORD, _hSourceFile: c::HANDLE, _hDestinationFile: c::HANDLE, - lpData: c::LPVOID, + lpData: c::LPCVOID, ) -> c::DWORD { if dwStreamNumber == 1 { *(lpData as *mut i64) = StreamBytesTransferred; @@ -1415,9 +1427,10 @@ fn symlink_junction_inner(original: &Path, junction: &Path) -> io::Result<()> { let f = File::open(junction, &opts)?; let h = f.as_inner().as_raw_handle(); unsafe { - let mut data = Align8([MaybeUninit::::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); + let mut data = + Align8([MaybeUninit::::uninit(); c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize]); let data_ptr = data.0.as_mut_ptr(); - let data_end = data_ptr.add(c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE); + let data_end = data_ptr.add(c::MAXIMUM_REPARSE_DATA_BUFFER_SIZE as usize); let db = data_ptr.cast::(); // Zero the header to ensure it's fully initialized, including reserved parameters. *db = mem::zeroed(); diff --git a/library/std/src/sys/windows/handle.rs b/library/std/src/sys/windows/handle.rs index c7677d1c13ab..84c1fbde32d2 100644 --- a/library/std/src/sys/windows/handle.rs +++ b/library/std/src/sys/windows/handle.rs @@ -144,7 +144,7 @@ impl Handle { let len = cmp::min(buf.len(), ::MAX as usize) as c::DWORD; let mut amt = 0; let res = cvt(c::ReadFile( - self.as_handle(), + self.as_raw_handle(), buf.as_ptr() as c::LPVOID, len, &mut amt, @@ -235,7 +235,7 @@ impl Handle { len: usize, offset: Option, ) -> io::Result { - let mut io_status = c::IO_STATUS_BLOCK::default(); + let mut io_status = c::IO_STATUS_BLOCK::PENDING; // The length is clamped at u32::MAX. let len = cmp::min(len, c::DWORD::MAX as usize) as c::DWORD; @@ -283,7 +283,7 @@ impl Handle { /// /// If `offset` is `None` then the current file position is used. fn synchronous_write(&self, buf: &[u8], offset: Option) -> io::Result { - let mut io_status = c::IO_STATUS_BLOCK::default(); + let mut io_status = c::IO_STATUS_BLOCK::PENDING; // The length is clamped at u32::MAX. let len = cmp::min(buf.len(), c::DWORD::MAX as usize) as c::DWORD; diff --git a/library/std/src/sys/windows/io.rs b/library/std/src/sys/windows/io.rs index 7fdd1f702e2f..fc9856caed62 100644 --- a/library/std/src/sys/windows/io.rs +++ b/library/std/src/sys/windows/io.rs @@ -17,10 +17,7 @@ impl<'a> IoSlice<'a> { pub fn new(buf: &'a [u8]) -> IoSlice<'a> { assert!(buf.len() <= c::ULONG::MAX as usize); IoSlice { - vec: c::WSABUF { - len: buf.len() as c::ULONG, - buf: buf.as_ptr() as *mut u8 as *mut c::CHAR, - }, + vec: c::WSABUF { len: buf.len() as c::ULONG, buf: buf.as_ptr() as *mut u8 }, _p: PhantomData, } } @@ -54,7 +51,7 @@ impl<'a> IoSliceMut<'a> { pub fn new(buf: &'a mut [u8]) -> IoSliceMut<'a> { assert!(buf.len() <= c::ULONG::MAX as usize); IoSliceMut { - vec: c::WSABUF { len: buf.len() as c::ULONG, buf: buf.as_mut_ptr() as *mut c::CHAR }, + vec: c::WSABUF { len: buf.len() as c::ULONG, buf: buf.as_mut_ptr() }, _p: PhantomData, } } diff --git a/library/std/src/sys/windows/net.rs b/library/std/src/sys/windows/net.rs index 8158713fa84a..2404bbe2b893 100644 --- a/library/std/src/sys/windows/net.rs +++ b/library/std/src/sys/windows/net.rs @@ -263,7 +263,7 @@ impl Socket { &mut nread, &mut flags, ptr::null_mut(), - ptr::null_mut(), + None, ) }; @@ -347,7 +347,7 @@ impl Socket { &mut nwritten, 0, ptr::null_mut(), - ptr::null_mut(), + None, ) }; cvt(result).map(|_| nwritten as usize) diff --git a/library/std/src/sys/windows/pipe.rs b/library/std/src/sys/windows/pipe.rs index 0780b29584da..d07147eccc1d 100644 --- a/library/std/src/sys/windows/pipe.rs +++ b/library/std/src/sys/windows/pipe.rs @@ -373,7 +373,7 @@ impl AnonPipe { // Asynchronous read of the pipe. // If successful, `callback` will be called once it completes. - let result = io(self.inner.as_handle(), buf, len, &mut overlapped, callback); + let result = io(self.inner.as_handle(), buf, len, &mut overlapped, Some(callback)); if result == c::FALSE { // We can return here because the call failed. // After this we must not return until the I/O completes. diff --git a/library/std/src/sys/windows/process.rs b/library/std/src/sys/windows/process.rs index 1c73b64e250e..df3667c0fd78 100644 --- a/library/std/src/sys/windows/process.rs +++ b/library/std/src/sys/windows/process.rs @@ -308,7 +308,7 @@ impl Command { let stderr = stderr.to_handle(c::STD_ERROR_HANDLE, &mut pipes.stderr)?; let mut si = zeroed_startupinfo(); - si.cb = mem::size_of::() as c::DWORD; + si.cb = mem::size_of::() as c::DWORD; // If at least one of stdin, stdout or stderr are set (i.e. are non null) // then set the `hStd` fields in `STARTUPINFO`. @@ -332,7 +332,7 @@ impl Command { flags, envp, dirp, - &mut si, + &si, &mut pi, )) }?; @@ -720,8 +720,8 @@ impl From for ExitCode { } } -fn zeroed_startupinfo() -> c::STARTUPINFO { - c::STARTUPINFO { +fn zeroed_startupinfo() -> c::STARTUPINFOW { + c::STARTUPINFOW { cb: 0, lpReserved: ptr::null_mut(), lpDesktop: ptr::null_mut(), @@ -731,7 +731,7 @@ fn zeroed_startupinfo() -> c::STARTUPINFO { dwXSize: 0, dwYSize: 0, dwXCountChars: 0, - dwYCountCharts: 0, + dwYCountChars: 0, dwFillAttribute: 0, dwFlags: 0, wShowWindow: 0, diff --git a/library/std/src/sys/windows/rand.rs b/library/std/src/sys/windows/rand.rs index cdf37cfe9117..bca4e38d9f62 100644 --- a/library/std/src/sys/windows/rand.rs +++ b/library/std/src/sys/windows/rand.rs @@ -1,3 +1,4 @@ +use crate::ffi::c_void; use crate::io; use crate::mem; use crate::ptr; @@ -25,8 +26,9 @@ pub fn hashmap_random_keys() -> (u64, u64) { #[inline(never)] fn fallback_rng() -> (u64, u64) { let mut v = (0, 0); - let ret = - unsafe { c::RtlGenRandom(&mut v as *mut _ as *mut u8, mem::size_of_val(&v) as c::ULONG) }; + let ret = unsafe { + c::RtlGenRandom(&mut v as *mut _ as *mut c_void, mem::size_of_val(&v) as c::ULONG) + }; if ret != 0 { v } else { panic!("fallback RNG broken: {}", io::Error::last_os_error()) } } diff --git a/library/std/src/sys/windows/stack_overflow.rs b/library/std/src/sys/windows/stack_overflow.rs index 18a2a36ad254..0caf0a317a4a 100644 --- a/library/std/src/sys/windows/stack_overflow.rs +++ b/library/std/src/sys/windows/stack_overflow.rs @@ -18,7 +18,7 @@ impl Handler { } } -extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -> c::LONG { +unsafe extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) -> c::LONG { unsafe { let rec = &(*(*ExceptionInfo).ExceptionRecord); let code = rec.ExceptionCode; @@ -34,7 +34,7 @@ extern "system" fn vectored_handler(ExceptionInfo: *mut c::EXCEPTION_POINTERS) - } pub unsafe fn init() { - if c::AddVectoredExceptionHandler(0, vectored_handler).is_null() { + if c::AddVectoredExceptionHandler(0, Some(vectored_handler)).is_null() { panic!("failed to install exception handler"); } // Set the thread stack guarantee for the main thread. diff --git a/library/std/src/sys/windows/stdio.rs b/library/std/src/sys/windows/stdio.rs index 32c6ccffb7a7..2e3e0859dc18 100644 --- a/library/std/src/sys/windows/stdio.rs +++ b/library/std/src/sys/windows/stdio.rs @@ -180,7 +180,7 @@ fn write_valid_utf8_to_console(handle: c::HANDLE, utf8: &str) -> io::Result]) -> io::Result() as c::ULONG, nInitialChars: 0, dwCtrlWakeupMask: CTRL_Z_MASK, @@ -360,7 +360,7 @@ fn read_u16s(handle: c::HANDLE, buf: &mut [MaybeUninit]) -> io::Result io::Result { let result = unsafe { c::WideCharToMultiByte( - c::CP_UTF8, // CodePage - c::WC_ERR_INVALID_CHARS, // dwFlags - utf16.as_ptr(), // lpWideCharStr - utf16.len() as c::c_int, // cchWideChar - utf8.as_mut_ptr() as c::LPSTR, // lpMultiByteStr - utf8.len() as c::c_int, // cbMultiByte - ptr::null(), // lpDefaultChar - ptr::null_mut(), // lpUsedDefaultChar + c::CP_UTF8, // CodePage + c::WC_ERR_INVALID_CHARS, // dwFlags + utf16.as_ptr(), // lpWideCharStr + utf16.len() as c::c_int, // cchWideChar + utf8.as_mut_ptr(), // lpMultiByteStr + utf8.len() as c::c_int, // cbMultiByte + ptr::null(), // lpDefaultChar + ptr::null_mut(), // lpUsedDefaultChar ) }; if result == 0 { diff --git a/library/std/src/sys/windows/thread.rs b/library/std/src/sys/windows/thread.rs index ed58c47e0907..18cecb65681d 100644 --- a/library/std/src/sys/windows/thread.rs +++ b/library/std/src/sys/windows/thread.rs @@ -2,6 +2,7 @@ use crate::ffi::CStr; use crate::io; use crate::num::NonZeroUsize; use crate::os::windows::io::AsRawHandle; +use crate::os::windows::io::HandleOrNull; use crate::ptr; use crate::sys::c; use crate::sys::handle::Handle; @@ -32,12 +33,12 @@ impl Thread { let ret = c::CreateThread( ptr::null_mut(), stack, - thread_start, + Some(thread_start), p as *mut _, c::STACK_SIZE_PARAM_IS_A_RESERVATION, ptr::null_mut(), ); - + let ret = HandleOrNull::from_raw_handle(ret); return if let Ok(handle) = ret.try_into() { Ok(Thread { handle: Handle::from_inner(handle) }) } else { From e314a3b21f921cb2b20bbb285929044eda23b612 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Fri, 5 May 2023 14:37:23 +0100 Subject: [PATCH 37/97] Sort windows_sys.lst alphabetically --- library/std/src/sys/windows/c/windows_sys.lst | 1259 +++++++++-------- src/tools/generate-windows-sys/src/main.rs | 2 +- 2 files changed, 632 insertions(+), 629 deletions(-) diff --git a/library/std/src/sys/windows/c/windows_sys.lst b/library/std/src/sys/windows/c/windows_sys.lst index 2953f8f2eaee..3e454199f13b 100644 --- a/library/std/src/sys/windows/c/windows_sys.lst +++ b/library/std/src/sys/windows/c/windows_sys.lst @@ -1,314 +1,42 @@ +// tidy-alphabetical-start +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 +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.NtCreateFile 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.DUPLICATE_HANDLE_OPTIONS -Windows.Win32.Foundation.DuplicateHandle -Windows.Win32.Foundation.EXCEPTION_STACK_OVERFLOW -Windows.Win32.Foundation.E_NOTIMPL -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.GetLastError -Windows.Win32.Foundation.HANDLE -Windows.Win32.Foundation.HANDLE_FLAGS -Windows.Win32.Foundation.HMODULE -Windows.Win32.Foundation.INVALID_HANDLE_VALUE -Windows.Win32.Foundation.MAX_PATH -Windows.Win32.Foundation.NTSTATUS -Windows.Win32.Foundation.RtlNtStatusToDosError -Windows.Win32.Foundation.STATUS_DELETE_PENDING -Windows.Win32.Foundation.STATUS_END_OF_FILE -Windows.Win32.Foundation.STATUS_INVALID_PARAMETER -Windows.Win32.Foundation.STATUS_PENDING -Windows.Win32.Foundation.STATUS_SUCCESS -Windows.Win32.Foundation.SetHandleInformation -Windows.Win32.Foundation.SetLastError -Windows.Win32.Foundation.TRUE -Windows.Win32.Foundation.UNICODE_STRING -Windows.Win32.Foundation.WIN32_ERROR -Windows.Win32.Globalization.COMPARESTRING_RESULT -Windows.Win32.Globalization.CP_UTF8 -Windows.Win32.Globalization.CompareStringOrdinal -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.ADDRESS_FAMILY -Windows.Win32.Networking.WinSock.ADDRINFOA -Windows.Win32.Networking.WinSock.FD_SET -Windows.Win32.Networking.WinSock.FIONBIO -Windows.Win32.Networking.WinSock.IN6_ADDR -Windows.Win32.Networking.WinSock.INVALID_SOCKET -Windows.Win32.Networking.WinSock.IN_ADDR -Windows.Win32.Networking.WinSock.IPPROTO -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.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.LINGER -Windows.Win32.Networking.WinSock.LPWSAOVERLAPPED_COMPLETION_ROUTINE -Windows.Win32.Networking.WinSock.SEND_RECV_FLAGS -Windows.Win32.Networking.WinSock.SOCKADDR -Windows.Win32.Networking.WinSock.SOCKET -Windows.Win32.Networking.WinSock.SOCKET_ERROR -Windows.Win32.Networking.WinSock.SOL_SOCKET -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.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.WSABUF -Windows.Win32.Networking.WinSock.WSACleanup -Windows.Win32.Networking.WinSock.WSADATA -Windows.Win32.Networking.WinSock.WSADATA -Windows.Win32.Networking.WinSock.WSADuplicateSocketW -Windows.Win32.Networking.WinSock.WSAGetLastError -Windows.Win32.Networking.WinSock.WSAPROTOCOLCHAIN -Windows.Win32.Networking.WinSock.WSAPROTOCOL_INFOW -Windows.Win32.Networking.WinSock.WSARecv -Windows.Win32.Networking.WinSock.WSASend -Windows.Win32.Networking.WinSock.WSASocketW -Windows.Win32.Networking.WinSock.WSAStartup -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.accept -Windows.Win32.Networking.WinSock.bind -Windows.Win32.Networking.WinSock.closesocket -Windows.Win32.Networking.WinSock.connect -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.ioctlsocket -Windows.Win32.Networking.WinSock.listen -Windows.Win32.Networking.WinSock.recv -Windows.Win32.Networking.WinSock.recvfrom -Windows.Win32.Networking.WinSock.select -Windows.Win32.Networking.WinSock.send -Windows.Win32.Networking.WinSock.sendto -Windows.Win32.Networking.WinSock.setsockopt -Windows.Win32.Networking.WinSock.shutdown -Windows.Win32.Security.SECURITY_ATTRIBUTES -Windows.Win32.Security.TOKEN_ACCESS_MASK -Windows.Win32.Security.Authentication.Identity.RtlGenRandom -Windows.Win32.Security.Cryptography.BCRYPTGENRANDOM_FLAGS -Windows.Win32.Security.Cryptography.BCRYPT_ALG_HANDLE -Windows.Win32.Security.Cryptography.BCryptGenRandom -Windows.Win32.Storage.FileSystem.BY_HANDLE_FILE_INFORMATION -Windows.Win32.Storage.FileSystem.CopyFileExW -Windows.Win32.Storage.FileSystem.CreateDirectoryW -Windows.Win32.Storage.FileSystem.CreateFileW -Windows.Win32.Storage.FileSystem.CreateHardLinkW -Windows.Win32.Storage.FileSystem.CreateSymbolicLinkW -Windows.Win32.Storage.FileSystem.DeleteFileW -Windows.Win32.Storage.FileSystem.FILE_ACCESS_RIGHTS -Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_TAG_INFO -Windows.Win32.Storage.FileSystem.FILE_BASIC_INFO -Windows.Win32.Storage.FileSystem.FILE_CREATION_DISPOSITION -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_OF_FILE_INFO -Windows.Win32.Storage.FileSystem.FILE_FLAGS_AND_ATTRIBUTES -Windows.Win32.Storage.FileSystem.FILE_ID_BOTH_DIR_INFO -Windows.Win32.Storage.FileSystem.FILE_INFO_BY_HANDLE_CLASS -Windows.Win32.Storage.FileSystem.FILE_SHARE_MODE -Windows.Win32.Storage.FileSystem.FILE_STANDARD_INFO -Windows.Win32.Storage.FileSystem.FILE_TYPE -Windows.Win32.Storage.FileSystem.FindClose -Windows.Win32.Storage.FileSystem.FindFileHandle -Windows.Win32.Storage.FileSystem.FindFirstFileW -Windows.Win32.Storage.FileSystem.FindNextFileW -Windows.Win32.Storage.FileSystem.FlushFileBuffers -Windows.Win32.Storage.FileSystem.GETFINALPATHNAMEBYHANDLE_FLAGS -Windows.Win32.Storage.FileSystem.GetFileAttributesW -Windows.Win32.Storage.FileSystem.GetFileInformationByHandle -Windows.Win32.Storage.FileSystem.GetFileInformationByHandleEx -Windows.Win32.Storage.FileSystem.GetFileType -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.LPPROGRESS_ROUTINE -Windows.Win32.Storage.FileSystem.LPPROGRESS_ROUTINE_CALLBACK_REASON -Windows.Win32.Storage.FileSystem.MAXIMUM_REPARSE_DATA_BUFFER_SIZE -Windows.Win32.Storage.FileSystem.MOVE_FILE_FLAGS -Windows.Win32.Storage.FileSystem.MoveFileExW -Windows.Win32.Storage.FileSystem.ReadFile -Windows.Win32.Storage.FileSystem.ReadFileEx -Windows.Win32.Storage.FileSystem.RemoveDirectoryW -Windows.Win32.Storage.FileSystem.SET_FILE_POINTER_MOVE_METHOD -Windows.Win32.Storage.FileSystem.SYMBOLIC_LINK_FLAGS -Windows.Win32.Storage.FileSystem.SetFileAttributesW -Windows.Win32.Storage.FileSystem.SetFileInformationByHandle -Windows.Win32.Storage.FileSystem.SetFilePointerEx -Windows.Win32.Storage.FileSystem.SetFileTime -Windows.Win32.Storage.FileSystem.WIN32_FIND_DATAW -Windows.Win32.Storage.FileSystem.WriteFileEx -Windows.Win32.System.Console.CONSOLE_MODE -Windows.Win32.System.Console.CONSOLE_READCONSOLE_CONTROL -Windows.Win32.System.Console.GetConsoleMode -Windows.Win32.System.Console.GetStdHandle -Windows.Win32.System.Console.ReadConsoleW -Windows.Win32.System.Console.STD_HANDLE -Windows.Win32.System.Console.WriteConsoleW -Windows.Win32.System.Diagnostics.Debug.ARM64_NT_NEON128 -Windows.Win32.System.Diagnostics.Debug.AddVectoredExceptionHandler -Windows.Win32.System.Diagnostics.Debug.CONTEXT -Windows.Win32.System.Diagnostics.Debug.CONTEXT -Windows.Win32.System.Diagnostics.Debug.CONTEXT -Windows.Win32.System.Diagnostics.Debug.EXCEPTION_POINTERS -Windows.Win32.System.Diagnostics.Debug.EXCEPTION_RECORD -Windows.Win32.System.Diagnostics.Debug.FACILITY_CODE -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.PVECTORED_EXCEPTION_HANDLER -Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT -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.FLOATING_SAVE_AREA -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.NAMED_PIPE_MODE -Windows.Win32.System.SystemInformation.GetSystemDirectoryW -Windows.Win32.System.SystemInformation.GetSystemInfo -Windows.Win32.System.SystemInformation.GetSystemTimeAsFileTime -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.IO_REPARSE_TAG_MOUNT_POINT -Windows.Win32.System.SystemServices.IO_REPARSE_TAG_SYMLINK -Windows.Win32.System.Threading.AcquireSRWLockExclusive -Windows.Win32.System.Threading.AcquireSRWLockShared -Windows.Win32.System.Threading.CreateEventW -Windows.Win32.System.Threading.CreateProcessW -Windows.Win32.System.Threading.CreateThread -Windows.Win32.System.Threading.ExitProcess -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.INFINITE -Windows.Win32.System.Threading.INIT_ONCE_INIT_FAILED -Windows.Win32.System.Threading.InitOnceBeginInitialize -Windows.Win32.System.Threading.InitOnceComplete -Windows.Win32.System.Threading.LPTHREAD_START_ROUTINE -Windows.Win32.System.Threading.OpenProcessToken -Windows.Win32.System.Threading.PROCESS_CREATION_FLAGS -Windows.Win32.System.Threading.PROCESS_INFORMATION -Windows.Win32.System.Threading.RTL_CONDITION_VARIABLE -Windows.Win32.System.Threading.RTL_RUN_ONCE -Windows.Win32.System.Threading.RTL_SRWLOCK -Windows.Win32.System.Threading.ReleaseSRWLockExclusive -Windows.Win32.System.Threading.ReleaseSRWLockShared -Windows.Win32.System.Threading.STARTUPINFOW -Windows.Win32.System.Threading.STARTUPINFOW_FLAGS -Windows.Win32.System.Threading.SetThreadStackGuarantee -Windows.Win32.System.Threading.Sleep -Windows.Win32.System.Threading.SleepConditionVariableSRW -Windows.Win32.System.Threading.SleepEx -Windows.Win32.System.Threading.SwitchToThread -Windows.Win32.System.Threading.THREAD_CREATION_FLAGS -Windows.Win32.System.Threading.TLS_OUT_OF_INDEXES -Windows.Win32.System.Threading.TerminateProcess -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.WaitForMultipleObjects -Windows.Win32.System.Threading.WaitForSingleObject -Windows.Win32.System.Threading.WakeAllConditionVariable -Windows.Win32.System.Threading.WakeConditionVariable -Windows.Win32.System.WindowsProgramming.IO_STATUS_BLOCK -Windows.Win32.System.WindowsProgramming.OBJECT_ATTRIBUTES -Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE -Windows.Win32.UI.Shell.GetUserProfileDirectoryW -Windows.Wdk.Storage.FileSystem.FILE_CREATE -Windows.Wdk.Storage.FileSystem.FILE_OPEN -Windows.Wdk.Storage.FileSystem.FILE_OPEN_IF -Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE -Windows.Wdk.Storage.FileSystem.FILE_OVERWRITE_IF -Windows.Wdk.Storage.FileSystem.FILE_SUPERSEDE -Windows.Wdk.Storage.FileSystem.FILE_COMPLETE_IF_OPLOCKED -Windows.Wdk.Storage.FileSystem.FILE_CONTAINS_EXTENDED_CREATE_INFORMATION -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 -Windows.Wdk.Storage.FileSystem.FILE_NON_DIRECTORY_FILE -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_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_NO_RECALL -Windows.Wdk.Storage.FileSystem.FILE_OPEN_REPARSE_POINT -Windows.Wdk.Storage.FileSystem.FILE_OPEN_REQUIRING_OPLOCK -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_SYNCHRONOUS_IO_ALERT -Windows.Wdk.Storage.FileSystem.FILE_SYNCHRONOUS_IO_NONALERT -Windows.Wdk.Storage.FileSystem.FILE_WRITE_THROUGH -Windows.Win32.Foundation.DUPLICATE_CLOSE_SOURCE -Windows.Win32.Foundation.DUPLICATE_SAME_ACCESS -Windows.Win32.Foundation.GENERIC_ALL -Windows.Win32.Foundation.GENERIC_EXECUTE -Windows.Win32.Foundation.GENERIC_READ -Windows.Win32.Foundation.GENERIC_WRITE -Windows.Win32.Foundation.HANDLE_FLAG_INHERIT -Windows.Win32.Foundation.HANDLE_FLAG_PROTECT_FROM_CLOSE Windows.Win32.Foundation.DNS_ERROR_ADDRESS_REQUIRED Windows.Win32.Foundation.DNS_ERROR_ALIAS_LOOP Windows.Win32.Foundation.DNS_ERROR_AUTOZONE_ALREADY_EXISTS @@ -361,9 +89,9 @@ 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_ZONESCOPE_NAME 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 @@ -373,6 +101,14 @@ 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 @@ -388,14 +124,6 @@ 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_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_NSEC3_INCOMPATIBLE_WITH_RSA_SHA1 Windows.Win32.Foundation.DNS_ERROR_NSEC3_NAME_COLLISION Windows.Win32.Foundation.DNS_ERROR_NSEC_INCOMPATIBLE_WITH_NSEC3_RSA_SHA1 @@ -425,9 +153,9 @@ 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_NOT_IMPLEMENTED Windows.Win32.Foundation.DNS_ERROR_RCODE_NXRRSET Windows.Win32.Foundation.DNS_ERROR_RCODE_REFUSED Windows.Win32.Foundation.DNS_ERROR_RCODE_SERVER_FAILURE @@ -471,10 +199,6 @@ 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_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.DNS_ERROR_ZONE_ALREADY_EXISTS Windows.Win32.Foundation.DNS_ERROR_ZONE_CONFIGURATION_ERROR Windows.Win32.Foundation.DNS_ERROR_ZONE_CREATION_FAILED @@ -486,9 +210,18 @@ 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_ABANDON_HIBERFILE Windows.Win32.Foundation.ERROR_ABIOS_ERROR Windows.Win32.Foundation.ERROR_ACCESS_AUDIT_BY_POLICY Windows.Win32.Foundation.ERROR_ACCESS_DENIED @@ -508,9 +241,9 @@ 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_ALL_USER_TRUST_QUOTA_EXCEEDED Windows.Win32.Foundation.ERROR_ALREADY_ASSIGNED Windows.Win32.Foundation.ERROR_ALREADY_EXISTS Windows.Win32.Foundation.ERROR_ALREADY_FIBER @@ -522,6 +255,9 @@ 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 @@ -538,9 +274,6 @@ 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_APP_HANG -Windows.Win32.Foundation.ERROR_APP_INIT_FAILURE -Windows.Win32.Foundation.ERROR_APP_WRONG_OS Windows.Win32.Foundation.ERROR_ARBITRATION_UNHANDLED Windows.Win32.Foundation.ERROR_ARENA_TRASHED Windows.Win32.Foundation.ERROR_ARITHMETIC_OVERFLOW @@ -551,9 +284,6 @@ 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_BADDB -Windows.Win32.Foundation.ERROR_BADKEY -Windows.Win32.Foundation.ERROR_BADSTARTPOSITION Windows.Win32.Foundation.ERROR_BAD_ACCESSOR_FLAGS Windows.Win32.Foundation.ERROR_BAD_ARGUMENTS Windows.Win32.Foundation.ERROR_BAD_COMMAND @@ -561,9 +291,9 @@ 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_DEV_TYPE Windows.Win32.Foundation.ERROR_BAD_DLL_ENTRYPOINT Windows.Win32.Foundation.ERROR_BAD_DRIVER_LEVEL Windows.Win32.Foundation.ERROR_BAD_ENVIRONMENT @@ -576,9 +306,9 @@ 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_NETPATH 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 @@ -591,33 +321,37 @@ 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_USERNAME 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_BLOCKED_BY_PARENTAL_CONTROLS 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_BUS_RESET 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_CALL_NOT_IMPLEMENTED -Windows.Win32.Foundation.ERROR_CANCELLED +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 @@ -628,11 +362,6 @@ 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_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_CANT_ACCESS_DOMAIN_INFO Windows.Win32.Foundation.ERROR_CANT_ACCESS_FILE Windows.Win32.Foundation.ERROR_CANT_CLEAR_ENCRYPTION_FLAG @@ -642,13 +371,17 @@ 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_CAN_NOT_COMPLETE +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_NO_POLICY 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 @@ -677,10 +410,10 @@ 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_IN_USE 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 @@ -737,20 +470,20 @@ 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_CSCSHARE_OFFLINE 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_DATABASE_DOES_NOT_EXIST -Windows.Win32.Foundation.ERROR_DATATYPE_MISMATCH 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 @@ -766,14 +499,15 @@ 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_DEBUGGER_INACTIVE 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 @@ -783,24 +517,23 @@ 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_NO_RESOURCES 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_DEV_NOT_EXIST Windows.Win32.Foundation.ERROR_DHCP_ADDRESS_CONFLICT Windows.Win32.Foundation.ERROR_DIFFERENT_SERVICE_ACCOUNT -Windows.Win32.Foundation.ERROR_DIRECTORY -Windows.Win32.Foundation.ERROR_DIRECTORY_NOT_SUPPORTED -Windows.Win32.Foundation.ERROR_DIRECT_ACCESS_HANDLE 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 @@ -831,25 +564,22 @@ 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_DRIVERS_LEAKING_LOCKED_PAGES +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_DRIVE_LOCKED +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_ALIASED_OBJ_MISSING 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_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_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 @@ -857,10 +587,13 @@ 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_AUTHORIZATION_FAILED 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 @@ -878,9 +611,9 @@ 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_DEL_MASTER_CROSSREF 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 @@ -900,10 +633,10 @@ 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_REMOVE_ATT_CACHE -Windows.Win32.Foundation.ERROR_DS_CANT_REMOVE_CLASS_CACHE 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 @@ -930,13 +663,13 @@ 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_CROSS_DOMAIN_CLEANUP_REQD +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_CR_IMPOSSIBLE_TO_VALIDATE -Windows.Win32.Foundation.ERROR_DS_CR_IMPOSSIBLE_TO_VALIDATE_V2 Windows.Win32.Foundation.ERROR_DS_DATABASE_ERROR Windows.Win32.Foundation.ERROR_DS_DECODING_ERROR Windows.Win32.Foundation.ERROR_DS_DESTINATION_AUDITING_NOT_ENABLED @@ -970,8 +703,8 @@ 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_NOT_SUPPORTED 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 @@ -992,11 +725,10 @@ 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_DS_REQUIRED -Windows.Win32.Foundation.ERROR_DS_DUPLICATE_ID_FOUND 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 @@ -1004,6 +736,7 @@ 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 @@ -1018,9 +751,9 @@ 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_GCVERIFY_ERROR 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 @@ -1046,8 +779,8 @@ 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_INSUFFICIENT_ATTR_TO_CREATE_OBJECT 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 @@ -1087,10 +820,10 @@ 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_NOT_FOUND -Windows.Win32.Foundation.ERROR_DS_NAME_ERROR_NOT_UNIQUE 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 @@ -1102,24 +835,10 @@ 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_NCNAME_MISSING_CR_REF -Windows.Win32.Foundation.ERROR_DS_NCNAME_MUST_BE_NC Windows.Win32.Foundation.ERROR_DS_NC_MUST_HAVE_NC_PARENT Windows.Win32.Foundation.ERROR_DS_NC_STILL_HAS_DSAS -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_NON_ASQ_SEARCH -Windows.Win32.Foundation.ERROR_DS_NON_BASE_SEARCH -Windows.Win32.Foundation.ERROR_DS_NOTIFY_FILTER_TOO_COMPLEX -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_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 @@ -1144,11 +863,22 @@ 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_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_OBJ_CLASS_NOT_DEFINED Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_NOT_SUBCLASS Windows.Win32.Foundation.ERROR_DS_OBJ_CLASS_VIOLATION @@ -1156,6 +886,9 @@ 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 @@ -1175,9 +908,9 @@ 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_REPLICATOR_ONLY -Windows.Win32.Foundation.ERROR_DS_REPLICA_SET_CHANGE_NOT_ALLOWED_ON_DISABLED_CR 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 @@ -1193,10 +926,10 @@ 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_SECURITY_CHECKING_ERROR -Windows.Win32.Foundation.ERROR_DS_SECURITY_ILLEGAL_MODIFY 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 @@ -1217,9 +950,9 @@ 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_SUB_CLS_TEST_FAIL Windows.Win32.Foundation.ERROR_DS_SYNTAX_MISMATCH Windows.Win32.Foundation.ERROR_DS_THREAD_LIMIT_EXCEEDED Windows.Win32.Foundation.ERROR_DS_TIMELIMIT_EXCEEDED @@ -1240,18 +973,18 @@ 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_DUPLICATE_PRIVILEGES -Windows.Win32.Foundation.ERROR_DUPLICATE_SERVICE_NAME 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_EAS_DIDNT_FIT -Windows.Win32.Foundation.ERROR_EAS_NOT_SUPPORTED 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 @@ -1273,11 +1006,11 @@ 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_EVENT_DONE -Windows.Win32.Foundation.ERROR_EVENT_PENDING Windows.Win32.Foundation.ERROR_EXCEPTION_IN_SERVICE Windows.Win32.Foundation.ERROR_EXCL_SEM_ALREADY_OWNED Windows.Win32.Foundation.ERROR_EXE_CANNOT_MODIFY_SIGNED_BINARY @@ -1288,16 +1021,14 @@ 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_FAILED_DRIVER_ENTRY -Windows.Win32.Foundation.ERROR_FAILED_SERVICE_CONTROLLER_CONNECT 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_FILEMARK_DETECTED -Windows.Win32.Foundation.ERROR_FILENAME_EXCED_RANGE Windows.Win32.Foundation.ERROR_FILE_CHECKED_OUT Windows.Win32.Foundation.ERROR_FILE_CORRUPT Windows.Win32.Foundation.ERROR_FILE_ENCRYPTED @@ -1312,8 +1043,8 @@ 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_INVALID_PARAMETER 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 @@ -1325,6 +1056,8 @@ 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 @@ -1335,9 +1068,9 @@ 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_FSFILTER_OP_COMPLETED_SUCCESSFULLY 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 @@ -1348,16 +1081,16 @@ 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_GENERIC_NOT_MAPPED 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_HANDLES_CLOSED 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 @@ -1369,11 +1102,11 @@ 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_ILL_FORMED_PASSWORD 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 @@ -1443,29 +1176,29 @@ 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_DOMAINNAME 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_EVENTNAME 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_FLAGS 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_GROUPNAME 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 @@ -1524,10 +1257,10 @@ 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_SERVICENAME 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 @@ -1550,22 +1283,22 @@ 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_IOPL_NOT_ENABLED 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_IPSEC_IKE_TIMED_OUT +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_JOINED Windows.Win32.Foundation.ERROR_IS_JOIN_PATH Windows.Win32.Foundation.ERROR_IS_JOIN_TARGET -Windows.Win32.Foundation.ERROR_IS_SUBSTED +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 @@ -1588,9 +1321,11 @@ 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_LOCKED 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 @@ -1599,8 +1334,6 @@ 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_LOG_FILE_FULL -Windows.Win32.Foundation.ERROR_LOG_HARD_ERROR Windows.Win32.Foundation.ERROR_LONGJUMP Windows.Win32.Foundation.ERROR_LOST_MODE_LOGON_RESTRICTION Windows.Win32.Foundation.ERROR_LOST_WRITEBEHIND_DATA @@ -1619,11 +1352,11 @@ 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_MEMBERS_PRIMARY_GROUP 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 @@ -1640,79 +1373,14 @@ 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_NET_OPEN_FAILED -Windows.Win32.Foundation.ERROR_NET_WRITE_FAULT -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_NONE_MAPPED -Windows.Win32.Foundation.ERROR_NONPAGED_SYSTEM_RESOURCES -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_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_NOT_ALLOWED_ON_SYSTEM_FILE -Windows.Win32.Foundation.ERROR_NOT_ALL_ASSIGNED -Windows.Win32.Foundation.ERROR_NOT_APPCONTAINER -Windows.Win32.Foundation.ERROR_NOT_AUTHENTICATED -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_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_READY -Windows.Win32.Foundation.ERROR_NOT_READ_FROM_COPY -Windows.Win32.Foundation.ERROR_NOT_REDUNDANT_STORAGE -Windows.Win32.Foundation.ERROR_NOT_REGISTRY_FILE -Windows.Win32.Foundation.ERROR_NOT_SAFEBOOT_SERVICE -Windows.Win32.Foundation.ERROR_NOT_SAFE_MODE_DRIVER -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_NO_ACE_CONDITION Windows.Win32.Foundation.ERROR_NO_ASSOCIATION Windows.Win32.Foundation.ERROR_NO_BYPASSIO_DRIVER_SUPPORT @@ -1724,8 +1392,8 @@ 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_LOGON_SERVERS 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 @@ -1734,8 +1402,8 @@ 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_NETWORK 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 @@ -1750,8 +1418,8 @@ 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_SITENAME 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 @@ -1779,8 +1447,73 @@ 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_NTLM_BLOCKED +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 @@ -1801,20 +1534,20 @@ 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_OUTOFMEMORY 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_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_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 @@ -1862,20 +1595,20 @@ 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_PRINT_CANCELLED 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_PROC_NOT_FOUND Windows.Win32.Foundation.ERROR_PRODUCT_UNINSTALLED Windows.Win32.Foundation.ERROR_PRODUCT_VERSION Windows.Win32.Foundation.ERROR_PROFILING_AT_LIMIT @@ -1896,20 +1629,20 @@ 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_REDIRECTOR_HAS_OPEN_HANDLES 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_REG_NAT_CONSUMPTION 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_REM_NOT_LIST Windows.Win32.Foundation.ERROR_REPARSE Windows.Win32.Foundation.ERROR_REPARSE_ATTRIBUTE_CONFLICT Windows.Win32.Foundation.ERROR_REPARSE_OBJECT @@ -1917,11 +1650,11 @@ 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_REQ_NOT_ACCEP Windows.Win32.Foundation.ERROR_RESIDENT_FILE_NOT_SUPPORTED Windows.Win32.Foundation.ERROR_RESOURCE_CALL_TIMED_OUT Windows.Win32.Foundation.ERROR_RESOURCE_DATA_NOT_FOUND @@ -1934,8 +1667,8 @@ 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_RING2SEG_MUST_BE_MOVABLE 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 @@ -1944,13 +1677,13 @@ 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_COMMITTED 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_SAME_DRIVE 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 @@ -1985,23 +1718,23 @@ 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_NOTIFICATION -Windows.Win32.Foundation.ERROR_SERVICE_NOTIFY_CLIENT_LAGGING +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_NO_THREAD +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_SETCOUNT_ON_BAD_LB -Windows.Win32.Foundation.ERROR_SETMARK_DETECTED 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 @@ -2044,8 +1777,8 @@ 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_SYNCHRONIZATION_REQUIRED 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 @@ -2059,12 +1792,12 @@ 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_TIME_SENSITIVE_THREAD -Windows.Win32.Foundation.ERROR_TIME_SKEW Windows.Win32.Foundation.ERROR_TLW_WITH_WSCHILD Windows.Win32.Foundation.ERROR_TOKEN_ALREADY_IN_USE Windows.Win32.Foundation.ERROR_TOO_MANY_CMDS @@ -2078,16 +1811,16 @@ 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_SEMAPHORES 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_TRUST_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 @@ -2095,11 +1828,11 @@ 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_UNEXP_NET_ERR Windows.Win32.Foundation.ERROR_UNHANDLED_EXCEPTION Windows.Win32.Foundation.ERROR_UNIDENTIFIED_ERROR Windows.Win32.Foundation.ERROR_UNKNOWN_COMPONENT @@ -2137,8 +1870,8 @@ 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_SUPPORTED 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 @@ -2169,15 +1902,48 @@ 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_XMLDSIG_ERROR 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.INVALID_HANDLE_VALUE +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_END_OF_FILE +Windows.Win32.Foundation.STATUS_INVALID_PARAMETER +Windows.Win32.Foundation.STATUS_PENDING +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 @@ -2185,9 +1951,37 @@ 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_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 @@ -2225,20 +2019,96 @@ 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.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.WSADATA +Windows.Win32.Networking.WinSock.WSADuplicateSocketW Windows.Win32.Networking.WinSock.WSAEACCES Windows.Win32.Networking.WinSock.WSAEADDRINUSE Windows.Win32.Networking.WinSock.WSAEADDRNOTAVAIL @@ -2289,55 +2159,30 @@ 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.WSANOTINITIALISED 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.Networking.WinSock.WSA_E_CANCELLED -Windows.Win32.Networking.WinSock.WSA_E_NO_MORE -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.Security.Authentication.Identity.RtlGenRandom +Windows.Win32.Security.Cryptography.BCRYPT_ALG_HANDLE +Windows.Win32.Security.Cryptography.BCRYPT_USE_SYSTEM_PREFERRED_RNG +Windows.Win32.Security.Cryptography.BCryptGenRandom +Windows.Win32.Security.Cryptography.BCRYPTGENRANDOM_FLAGS +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 @@ -2359,47 +2204,23 @@ 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.Security.Cryptography.BCRYPT_USE_SYSTEM_PREFERRED_RNG +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_APPEND_DATA -Windows.Win32.Storage.FileSystem.FILE_CREATE_PIPE_INSTANCE -Windows.Win32.Storage.FileSystem.FILE_DELETE_CHILD -Windows.Win32.Storage.FileSystem.FILE_EXECUTE -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_LIST_DIRECTORY -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_TRAVERSE -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.READ_CONTROL -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.SYNCHRONIZE -Windows.Win32.Storage.FileSystem.WRITE_DAC -Windows.Win32.Storage.FileSystem.WRITE_OWNER -Windows.Win32.Storage.FileSystem.CREATE_ALWAYS -Windows.Win32.Storage.FileSystem.CREATE_NEW -Windows.Win32.Storage.FileSystem.OPEN_ALWAYS -Windows.Win32.Storage.FileSystem.OPEN_EXISTING -Windows.Win32.Storage.FileSystem.TRUNCATE_EXISTING -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_ATTRIBUTE_ARCHIVE Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_COMPRESSED Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_DEVICE @@ -2408,9 +2229,9 @@ 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_NO_SCRUB_DATA Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_OFFLINE Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_PINNED Windows.Win32.Storage.FileSystem.FILE_ATTRIBUTE_READONLY @@ -2419,9 +2240,28 @@ 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 @@ -2434,17 +2274,34 @@ 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.PIPE_ACCESS_DUPLEX -Windows.Win32.Storage.FileSystem.PIPE_ACCESS_INBOUND -Windows.Win32.Storage.FileSystem.PIPE_ACCESS_OUTBOUND -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.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_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_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 @@ -2470,34 +2327,74 @@ 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.FindFileHandle +Windows.Win32.Storage.FileSystem.FindFirstFileW +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.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.FILE_SHARE_DELETE -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_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_NAME_NORMALIZED -Windows.Win32.Storage.FileSystem.FILE_NAME_OPENED -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.CALLBACK_CHUNK_FINISHED -Windows.Win32.Storage.FileSystem.CALLBACK_STREAM_SWITCH +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.FILE_BEGIN -Windows.Win32.Storage.FileSystem.FILE_CURRENT -Windows.Win32.Storage.FileSystem.FILE_END +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.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 @@ -2513,9 +2410,22 @@ 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.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.CONTEXT +Windows.Win32.System.Diagnostics.Debug.CONTEXT +Windows.Win32.System.Diagnostics.Debug.EXCEPTION_POINTERS +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 @@ -2523,10 +2433,42 @@ 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.PVECTORED_EXCEPTION_HANDLER +Windows.Win32.System.Diagnostics.Debug.XSAVE_FORMAT +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.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.NAMED_PIPE_MODE Windows.Win32.System.Pipes.PIPE_ACCEPT_REMOTE_CLIENTS Windows.Win32.System.Pipes.PIPE_CLIENT_END Windows.Win32.System.Pipes.PIPE_NOWAIT @@ -2537,7 +2479,20 @@ 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.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.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.BELOW_NORMAL_PRIORITY_CLASS Windows.Win32.System.Threading.CREATE_BREAKAWAY_FROM_JOB Windows.Win32.System.Threading.CREATE_DEFAULT_ERROR_MODE @@ -2553,21 +2508,48 @@ 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.CreateEventW +Windows.Win32.System.Threading.CreateProcessW +Windows.Win32.System.Threading.CreateThread Windows.Win32.System.Threading.DEBUG_ONLY_THIS_PROCESS Windows.Win32.System.Threading.DEBUG_PROCESS Windows.Win32.System.Threading.DETACHED_PROCESS +Windows.Win32.System.Threading.ExitProcess Windows.Win32.System.Threading.EXTENDED_STARTUPINFO_PRESENT +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.InitOnceBeginInitialize +Windows.Win32.System.Threading.InitOnceComplete +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.RTL_CONDITION_VARIABLE +Windows.Win32.System.Threading.RTL_RUN_ONCE +Windows.Win32.System.Threading.RTL_SRWLOCK +Windows.Win32.System.Threading.SetThreadStackGuarantee +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 @@ -2582,6 +2564,27 @@ 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.STACK_SIZE_PARAM_IS_A_RESERVATION +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.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.WaitForMultipleObjects +Windows.Win32.System.Threading.WaitForSingleObject +Windows.Win32.System.Threading.WakeAllConditionVariable +Windows.Win32.System.Threading.WakeConditionVariable +Windows.Win32.System.WindowsProgramming.IO_STATUS_BLOCK +Windows.Win32.System.WindowsProgramming.OBJECT_ATTRIBUTES +Windows.Win32.System.WindowsProgramming.PROGRESS_CONTINUE +Windows.Win32.UI.Shell.GetUserProfileDirectoryW +// tidy-alphabetical-end + diff --git a/src/tools/generate-windows-sys/src/main.rs b/src/tools/generate-windows-sys/src/main.rs index 0b091b1ebfa9..91d981462e81 100644 --- a/src/tools/generate-windows-sys/src/main.rs +++ b/src/tools/generate-windows-sys/src/main.rs @@ -22,7 +22,7 @@ fn main() -> io::Result<()> { .lines() .filter_map(|line| { let line = line.trim(); - if line.is_empty() || line.starts_with('#') { None } else { Some(line) } + if line.is_empty() || line.starts_with("//") { None } else { Some(line) } }) .collect(); From 442617c0468018aa88bcee8a8b12da8525352708 Mon Sep 17 00:00:00 2001 From: Boxy Date: Fri, 5 May 2023 21:31:00 +0100 Subject: [PATCH 38/97] misc nameres changes for anon consts --- compiler/rustc_ast/src/ast.rs | 13 +- compiler/rustc_ast/src/visit.rs | 5 +- compiler/rustc_ast_lowering/src/lib.rs | 8 +- .../src/error_codes/E0771.md | 4 +- .../src/collect/generics_of.rs | 31 ++- compiler/rustc_resolve/src/ident.rs | 12 +- compiler/rustc_resolve/src/late.rs | 262 +++++++++++------- 7 files changed, 202 insertions(+), 133 deletions(-) diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs index b5dba0713bfa..fa1155f135d2 100644 --- a/compiler/rustc_ast/src/ast.rs +++ b/compiler/rustc_ast/src/ast.rs @@ -120,6 +120,12 @@ impl Path { pub fn is_global(&self) -> bool { !self.segments.is_empty() && self.segments[0].ident.name == kw::PathRoot } + + /// If this path is a single identifier with no arguments, does not ensure + /// that the path resolves to a const param, the caller should check this. + pub fn is_potential_trivial_const_arg(&self) -> bool { + self.segments.len() == 1 && self.segments[0].args.is_none() + } } /// A segment of a path: an identifier, an optional lifetime, and a set of types. @@ -1154,7 +1160,9 @@ impl Expr { /// /// If this is not the case, name resolution does not resolve `N` when using /// `min_const_generics` as more complex expressions are not supported. - pub fn is_potential_trivial_const_param(&self) -> bool { + /// + /// Does not ensure that the path resolves to a const param, the caller should check this. + pub fn is_potential_trivial_const_arg(&self) -> bool { let this = if let ExprKind::Block(block, None) = &self.kind && block.stmts.len() == 1 && let StmtKind::Expr(expr) = &block.stmts[0].kind @@ -1165,8 +1173,7 @@ impl Expr { }; if let ExprKind::Path(None, path) = &this.kind - && path.segments.len() == 1 - && path.segments[0].args.is_none() + && path.is_potential_trivial_const_arg() { true } else { diff --git a/compiler/rustc_ast/src/visit.rs b/compiler/rustc_ast/src/visit.rs index 1526ffa0b030..275692ad5dda 100644 --- a/compiler/rustc_ast/src/visit.rs +++ b/compiler/rustc_ast/src/visit.rs @@ -188,6 +188,9 @@ pub trait Visitor<'ast>: Sized { fn visit_variant(&mut self, v: &'ast Variant) { walk_variant(self, v) } + fn visit_variant_discr(&mut self, discr: &'ast AnonConst) { + self.visit_anon_const(discr); + } fn visit_label(&mut self, label: &'ast Label) { walk_label(self, label) } @@ -380,7 +383,7 @@ where visitor.visit_ident(variant.ident); visitor.visit_vis(&variant.vis); visitor.visit_variant_data(&variant.data); - walk_list!(visitor, visit_anon_const, &variant.disr_expr); + walk_list!(visitor, visit_variant_discr, &variant.disr_expr); walk_list!(visitor, visit_attribute, &variant.attrs); } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index 4100efb6eb33..ce3b0acdab37 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1190,13 +1190,15 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // parsing. We try to resolve that ambiguity by attempting resolution in both the // type and value namespaces. If we resolved the path in the value namespace, we // transform it into a generic const argument. - TyKind::Path(qself, path) => { + TyKind::Path(None, path) => { if let Some(res) = self .resolver .get_partial_res(ty.id) .and_then(|partial_res| partial_res.full_res()) { - if !res.matches_ns(Namespace::TypeNS) { + if !res.matches_ns(Namespace::TypeNS) + && path.is_potential_trivial_const_arg() + { debug!( "lower_generic_arg: Lowering type argument as const argument: {:?}", ty, @@ -1218,7 +1220,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { let path_expr = Expr { id: ty.id, - kind: ExprKind::Path(qself.clone(), path.clone()), + kind: ExprKind::Path(None, path.clone()), span, attrs: AttrVec::new(), tokens: None, diff --git a/compiler/rustc_error_codes/src/error_codes/E0771.md b/compiler/rustc_error_codes/src/error_codes/E0771.md index a2a1a20f2303..4f36590025ba 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0771.md +++ b/compiler/rustc_error_codes/src/error_codes/E0771.md @@ -1,9 +1,11 @@ +#### Note: this error code is no longer emitted by the compiler + A non-`'static` lifetime was used in a const generic. This is currently not allowed. Erroneous code example: -```compile_fail,E0771 +```compile_fail,E0770 #![feature(adt_const_params)] fn function_with_str<'a, const STRING: &'a str>() {} // error! diff --git a/compiler/rustc_hir_analysis/src/collect/generics_of.rs b/compiler/rustc_hir_analysis/src/collect/generics_of.rs index 119933697a16..ab2932bf969a 100644 --- a/compiler/rustc_hir_analysis/src/collect/generics_of.rs +++ b/compiler/rustc_hir_analysis/src/collect/generics_of.rs @@ -51,7 +51,15 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { // of a const parameter type, e.g. `struct Foo` is not allowed. None } else if tcx.lazy_normalization() { - if let Some(param_id) = tcx.hir().opt_const_param_default_param_def_id(hir_id) { + let parent_node = tcx.hir().get_parent(hir_id); + if let Node::Variant(Variant { disr_expr: Some(constant), .. }) = parent_node + && constant.hir_id == hir_id + { + // enum variant discriminants are not allowed to use any kind of generics + None + } else if let Some(param_id) = + tcx.hir().opt_const_param_default_param_def_id(hir_id) + { // If the def_id we are calling generics_of on is an anon ct default i.e: // // struct Foo; @@ -94,15 +102,15 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { has_self: generics.has_self, has_late_bound_regions: generics.has_late_bound_regions, }; + } else { + // HACK(eddyb) this provides the correct generics when + // `feature(generic_const_expressions)` is enabled, so that const expressions + // used with const generics, e.g. `Foo<{N+1}>`, can work at all. + // + // Note that we do not supply the parent generics when using + // `min_const_generics`. + Some(parent_def_id.to_def_id()) } - - // HACK(eddyb) this provides the correct generics when - // `feature(generic_const_expressions)` is enabled, so that const expressions - // used with const generics, e.g. `Foo<{N+1}>`, can work at all. - // - // Note that we do not supply the parent generics when using - // `min_const_generics`. - Some(parent_def_id.to_def_id()) } else { let parent_node = tcx.hir().get_parent(hir_id); match parent_node { @@ -115,11 +123,6 @@ pub(super) fn generics_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> ty::Generics { { Some(parent_def_id.to_def_id()) } - Node::Variant(Variant { disr_expr: Some(constant), .. }) - if constant.hir_id == hir_id => - { - Some(parent_def_id.to_def_id()) - } Node::Expr(&Expr { kind: ExprKind::ConstBlock(_), .. }) => { Some(tcx.typeck_root_def_id(def_id.to_def_id())) } diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 2db1d83d4fd5..4e1d49c12a76 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -1188,11 +1188,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } RibKind::ConstantItem(trivial, _) => { - let features = self.tcx.sess.features_untracked(); - // HACK(min_const_generics): We currently only allow `N` or `{ N }`. - if !(trivial == ConstantHasGenerics::Yes - || features.generic_const_exprs) - { + if let ConstantHasGenerics::No(cause) = trivial { // HACK(min_const_generics): If we encounter `Self` in an anonymous // constant we can't easily tell if it's generic at this stage, so // we instead remember this and then enforce the self type to be @@ -1264,11 +1260,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { | RibKind::ForwardGenericParamBan => continue, RibKind::ConstantItem(trivial, _) => { - let features = self.tcx.sess.features_untracked(); - // HACK(min_const_generics): We currently only allow `N` or `{ N }`. - if !(trivial == ConstantHasGenerics::Yes - || features.generic_const_exprs) - { + if let ConstantHasGenerics::No(cause) = trivial { if let Some(span) = finalize { self.report_error( span, diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index 6f5d54bcf87e..c6b193710e08 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -66,6 +66,15 @@ enum IsRepeatExpr { Yes, } +/// Describes whether an `AnonConst` is a type level const arg or +/// some other form of anon const (i.e. inline consts or enum discriminants) +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +enum AnonConstKind { + EnumDiscriminant, + InlineConst, + ConstArg(IsRepeatExpr), +} + impl PatternSource { fn descr(self) -> &'static str { match self { @@ -105,7 +114,7 @@ pub(crate) enum HasGenericParams { #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub(crate) enum ConstantHasGenerics { Yes, - No, + No(NoConstantGenericsReason), } impl ConstantHasGenerics { @@ -114,6 +123,27 @@ impl ConstantHasGenerics { } } +/// Reason for why an anon const is not allowed to reference generic parameters +#[derive(Copy, Clone, Debug, Eq, PartialEq)] +pub(crate) enum NoConstantGenericsReason { + /// Const arguments are only allowed to use generic parameters when: + /// - `feature(generic_const_exprs)` is enabled + /// or + /// - the const argument is a sole const generic paramater, i.e. `foo::<{ N }>()` + /// + /// If neither of the above are true then this is used as the cause. + NonTrivialConstArg, + /// Enum discriminants are not allowed to reference generic parameters ever, this + /// is used when an anon const is in the following position: + /// + /// ```rust,compile_fail + /// enum Foo { + /// Variant = { N }, // this anon const is not allowed to use generics + /// } + /// ``` + IsEnumDiscriminant, +} + #[derive(Copy, Clone, Debug, Eq, PartialEq)] pub(crate) enum ConstantItemKind { Const, @@ -273,15 +303,18 @@ enum LifetimeRibKind { /// Signal we cannot find which should be the anonymous lifetime. ElisionFailure, - /// FIXME(const_generics): This patches over an ICE caused by non-'static lifetimes in const - /// generics. We are disallowing this until we can decide on how we want to handle non-'static - /// lifetimes in const generics. See issue #74052 for discussion. - ConstGeneric, + /// This rib forbids usage of generic parameters inside of const parameter types. + /// + /// While this is desirable to support eventually, it is difficult to do and so is + /// currently forbidden. See rust-lang/project-const-generics#28 for more info. + ConstParamTy, - /// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics`. - /// This function will emit an error if `generic_const_exprs` is not enabled, the body - /// identified by `body_id` is an anonymous constant and `lifetime_ref` is non-static. - AnonConst, + /// Usage of generic parameters is forbidden in various positions for anon consts: + /// - const arguments when `generic_const_exprs` is not enabled + /// - enum discriminant values + /// + /// This rib emits an error when a lifetime would resolve to a lifetime parameter. + ConcreteAnonConst(NoConstantGenericsReason), /// This rib acts as a barrier to forbid reference to lifetimes of a parent item. Item, @@ -648,13 +681,8 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, self.resolve_block(block); self.parent_scope.macro_rules = old_macro_rules; } - fn visit_anon_const(&mut self, constant: &'ast AnonConst) { - // We deal with repeat expressions explicitly in `resolve_expr`. - self.with_lifetime_rib(LifetimeRibKind::AnonConst, |this| { - this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { - this.resolve_anon_const(constant, IsRepeatExpr::No); - }) - }) + fn visit_anon_const(&mut self, _constant: &'ast AnonConst) { + bug!("encountered anon const without a manual call to `resolve_anon_const`"); } fn visit_expr(&mut self, expr: &'ast Expr) { self.resolve_expr(expr, None); @@ -676,7 +704,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, fn visit_ty(&mut self, ty: &'ast Ty) { let prev = self.diagnostic_metadata.current_trait_object; let prev_ty = self.diagnostic_metadata.current_type_path; - match ty.kind { + match &ty.kind { TyKind::Ref(None, _) => { // Elided lifetime in reference: we resolve as if there was some lifetime `'_` with // NodeId `ty.id`. @@ -685,7 +713,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, self.resolve_elided_lifetime(ty.id, span); visit::walk_ty(self, ty); } - TyKind::Path(ref qself, ref path) => { + TyKind::Path(qself, path) => { self.diagnostic_metadata.current_type_path = Some(ty); self.smart_resolve_path(ty.id, &qself, path, PathSource::Type); @@ -730,11 +758,11 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, visit::walk_ty(self, ty); self.lifetime_elision_candidates = candidates; } - TyKind::TraitObject(ref bounds, ..) => { + TyKind::TraitObject(bounds, ..) => { self.diagnostic_metadata.current_trait_object = Some(&bounds[..]); visit::walk_ty(self, ty) } - TyKind::BareFn(ref bare_fn) => { + TyKind::BareFn(bare_fn) => { let span = ty.span.shrink_to_lo().to(bare_fn.decl_span.shrink_to_lo()); self.with_generic_param_rib( &bare_fn.generic_params, @@ -769,6 +797,13 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, }, ) } + TyKind::Array(element_ty, length) => { + self.visit_ty(element_ty); + self.resolve_anon_const(length, AnonConstKind::ConstArg(IsRepeatExpr::No)); + } + TyKind::Typeof(ct) => { + self.resolve_anon_const(ct, AnonConstKind::ConstArg(IsRepeatExpr::No)) + } _ => visit::walk_ty(self, ty), } self.diagnostic_metadata.current_trait_object = prev; @@ -994,36 +1029,25 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, // namespace first, and if that fails we try again in the value namespace. If // resolution in the value namespace succeeds, we have an generic const argument on // our hands. - if let TyKind::Path(ref qself, ref path) = ty.kind { + if let TyKind::Path(None, ref path) = ty.kind { // We cannot disambiguate multi-segment paths right now as that requires type // checking. - if path.segments.len() == 1 && path.segments[0].args.is_none() { + if path.is_potential_trivial_const_arg() { let mut check_ns = |ns| { self.maybe_resolve_ident_in_lexical_scope(path.segments[0].ident, ns) .is_some() }; if !check_ns(TypeNS) && check_ns(ValueNS) { - // This must be equivalent to `visit_anon_const`, but we cannot call it - // directly due to visitor lifetimes so we have to copy-paste some code. - // - // Note that we might not be inside of an repeat expression here, - // but considering that `IsRepeatExpr` is only relevant for - // non-trivial constants this is doesn't matter. - self.with_constant_rib( - IsRepeatExpr::No, - ConstantHasGenerics::Yes, - None, + self.resolve_anon_const_manual( + true, + AnonConstKind::ConstArg(IsRepeatExpr::No), |this| { this.smart_resolve_path( ty.id, - qself, + &None, path, PathSource::Expr(None), ); - - if let Some(ref qself) = *qself { - this.visit_ty(&qself.ty); - } this.visit_path(path, ty.id); }, ); @@ -1037,7 +1061,9 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, self.visit_ty(ty); } GenericArg::Lifetime(lt) => self.visit_lifetime(lt, visit::LifetimeCtxt::GenericArg), - GenericArg::Const(ct) => self.visit_anon_const(ct), + GenericArg::Const(ct) => { + self.resolve_anon_const(ct, AnonConstKind::ConstArg(IsRepeatExpr::No)) + } } self.diagnostic_metadata.currently_processing_generics = prev; } @@ -1053,7 +1079,9 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, match constraint.kind { AssocConstraintKind::Equality { ref term } => match term { Term::Ty(ty) => self.visit_ty(ty), - Term::Const(c) => self.visit_anon_const(c), + Term::Const(c) => { + self.resolve_anon_const(c, AnonConstKind::ConstArg(IsRepeatExpr::No)) + } }, AssocConstraintKind::Bound { ref bounds } => { walk_list!(self, visit_param_bound, bounds, BoundKind::Bound); @@ -1102,8 +1130,8 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, | LifetimeRibKind::AnonymousReportError | LifetimeRibKind::Elided(_) | LifetimeRibKind::ElisionFailure - | LifetimeRibKind::AnonConst - | LifetimeRibKind::ConstGeneric => {} + | LifetimeRibKind::ConcreteAnonConst(_) + | LifetimeRibKind::ConstParamTy => {} } } } @@ -1164,7 +1192,7 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, InlineAsmOperand::Const { anon_const, .. } => { // Although this is `DefKind::AnonConst`, it is allowed to reference outer // generic parameters like an inline const. - self.resolve_inline_const(anon_const); + self.resolve_anon_const(anon_const, AnonConstKind::InlineConst); } InlineAsmOperand::Sym { sym } => self.visit_inline_asm_sym(sym), } @@ -1188,6 +1216,10 @@ impl<'a: 'ast, 'ast, 'tcx> Visitor<'ast> for LateResolutionVisitor<'a, '_, 'ast, visit::walk_variant(self, v) } + fn visit_variant_discr(&mut self, discr: &'ast AnonConst) { + self.resolve_anon_const(discr, AnonConstKind::EnumDiscriminant); + } + fn visit_field_def(&mut self, f: &'ast FieldDef) { self.resolve_doc_links(&f.attrs, MaybeExported::Ok(f.id)); visit::walk_field_def(self, f) @@ -1386,7 +1418,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { this.ribs[TypeNS].push(Rib::new(RibKind::ConstParamTy)); this.ribs[ValueNS].push(Rib::new(RibKind::ConstParamTy)); - this.with_lifetime_rib(LifetimeRibKind::ConstGeneric, |this| { + this.with_lifetime_rib(LifetimeRibKind::ConstParamTy, |this| { this.visit_ty(ty) }); this.ribs[TypeNS].pop().unwrap(); @@ -1395,9 +1427,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { if let Some(ref expr) = default { this.ribs[TypeNS].push(forward_ty_ban_rib); this.ribs[ValueNS].push(forward_const_ban_rib); - this.with_lifetime_rib(LifetimeRibKind::ConstGeneric, |this| { - this.resolve_anon_const(expr, IsRepeatExpr::No) - }); + this.resolve_anon_const( + expr, + AnonConstKind::ConstArg(IsRepeatExpr::No), + ); forward_const_ban_rib = this.ribs[ValueNS].pop().unwrap(); forward_ty_ban_rib = this.ribs[TypeNS].pop().unwrap(); } @@ -1475,8 +1508,8 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { LifetimeUseSet::Many }), LifetimeRibKind::Generics { .. } - | LifetimeRibKind::ConstGeneric => None, - LifetimeRibKind::AnonConst => { + | LifetimeRibKind::ConstParamTy => None, + LifetimeRibKind::ConcreteAnonConst(_) => { span_bug!(ident.span, "unexpected rib kind: {:?}", rib.kind) } }) @@ -1495,7 +1528,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { match rib.kind { LifetimeRibKind::Item => break, - LifetimeRibKind::ConstGeneric => { + LifetimeRibKind::ConstParamTy => { self.emit_non_static_lt_in_const_generic_error(lifetime); self.record_lifetime_res( lifetime.id, @@ -1504,7 +1537,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { ); return; } - LifetimeRibKind::AnonConst => { + LifetimeRibKind::ConcreteAnonConst(cause) => { self.maybe_emit_forbidden_non_static_lifetime_error(lifetime); self.record_lifetime_res( lifetime.id, @@ -1604,9 +1637,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { return; } LifetimeRibKind::Item => break, - LifetimeRibKind::Generics { .. } | LifetimeRibKind::ConstGeneric => {} - LifetimeRibKind::AnonConst => { - // There is always an `Elided(LifetimeRes::Static)` inside an `AnonConst`. + LifetimeRibKind::Generics { .. } | LifetimeRibKind::ConstParamTy => {} + LifetimeRibKind::ConcreteAnonConst(_) => { + // There is always an `Elided(LifetimeRes::Infer)` inside an `AnonConst`. span_bug!(lifetime.ident.span, "unexpected rib kind: {:?}", rib.kind) } } @@ -1826,9 +1859,9 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { self.report_missing_lifetime_specifiers(vec![missing_lifetime], None); break; } - LifetimeRibKind::Generics { .. } | LifetimeRibKind::ConstGeneric => {} - LifetimeRibKind::AnonConst => { - // There is always an `Elided(LifetimeRes::Static)` inside an `AnonConst`. + LifetimeRibKind::Generics { .. } | LifetimeRibKind::ConstParamTy => {} + LifetimeRibKind::ConcreteAnonConst(_) => { + // There is always an `Elided(LifetimeRes::Infer)` inside an `AnonConst`. span_bug!(elided_lifetime_span, "unexpected rib kind: {:?}", rib.kind) } } @@ -2560,7 +2593,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { self.with_rib(ValueNS, kind, |this| this.with_rib(TypeNS, kind, f)) } - // HACK(min_const_generics,const_evaluatable_unchecked): We + // HACK(min_const_generics, generic_const_exprs): We // want to keep allowing `[0; std::mem::size_of::<*mut T>()]` // with a future compat lint for now. We do this by adding an // additional special case for repeat expressions. @@ -2576,18 +2609,26 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { item: Option<(Ident, ConstantItemKind)>, f: impl FnOnce(&mut Self), ) { - self.with_rib(ValueNS, RibKind::ConstantItem(may_use_generics, item), |this| { - this.with_rib( - TypeNS, - RibKind::ConstantItem( - may_use_generics.force_yes_if(is_repeat == IsRepeatExpr::Yes), - item, - ), - |this| { - this.with_label_rib(RibKind::ConstantItem(may_use_generics, item), f); - }, - ) - }); + let f = |this: &mut Self| { + this.with_rib(ValueNS, RibKind::ConstantItem(may_use_generics, item), |this| { + this.with_rib( + TypeNS, + RibKind::ConstantItem( + may_use_generics.force_yes_if(is_repeat == IsRepeatExpr::Yes), + item, + ), + |this| { + this.with_label_rib(RibKind::ConstantItem(may_use_generics, item), f); + }, + ) + }) + }; + + if let ConstantHasGenerics::No(cause) = may_use_generics { + self.with_lifetime_rib(LifetimeRibKind::ConcreteAnonConst(cause), f) + } else { + f(self) + } } fn with_current_self_type(&mut self, self_type: &Ty, f: impl FnOnce(&mut Self) -> T) -> T { @@ -3924,24 +3965,54 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { debug!("(resolving block) leaving block"); } - fn resolve_anon_const(&mut self, constant: &'ast AnonConst, is_repeat: IsRepeatExpr) { - debug!("resolve_anon_const {:?} is_repeat: {:?}", constant, is_repeat); - self.with_constant_rib( - is_repeat, - if constant.value.is_potential_trivial_const_param() { - ConstantHasGenerics::Yes - } else { - ConstantHasGenerics::No - }, - None, - |this| visit::walk_anon_const(this, constant), + fn resolve_anon_const(&mut self, constant: &'ast AnonConst, anon_const_kind: AnonConstKind) { + debug!( + "resolve_anon_const(constant: {:?}, anon_const_kind: {:?})", + constant, anon_const_kind ); + + self.resolve_anon_const_manual( + constant.value.is_potential_trivial_const_arg(), + anon_const_kind, + |this| this.resolve_expr(&constant.value, None), + ) } - fn resolve_inline_const(&mut self, constant: &'ast AnonConst) { - debug!("resolve_anon_const {constant:?}"); - self.with_constant_rib(IsRepeatExpr::No, ConstantHasGenerics::Yes, None, |this| { - visit::walk_anon_const(this, constant) + /// There are a few places that we need to resolve an anon const but we did not parse an + /// anon const so cannot provide an `&'ast AnonConst`. Right now this is just unbraced + /// const arguments that were parsed as type arguments, and `legact_const_generics` which + /// parse as normal function argument expressions. To avoid duplicating the code for resolving + /// an anon const we have this function which lets the caller manually call `resolve_expr` or + /// `smart_resolve_path`. + fn resolve_anon_const_manual( + &mut self, + is_trivial_const_arg: bool, + anon_const_kind: AnonConstKind, + resolve_expr: impl FnOnce(&mut Self), + ) { + let is_repeat_expr = match anon_const_kind { + AnonConstKind::ConstArg(is_repeat_expr) => is_repeat_expr, + _ => IsRepeatExpr::No, + }; + + let may_use_generics = match anon_const_kind { + AnonConstKind::EnumDiscriminant => { + ConstantHasGenerics::No(NoConstantGenericsReason::IsEnumDiscriminant) + } + AnonConstKind::InlineConst => ConstantHasGenerics::Yes, + AnonConstKind::ConstArg(_) => { + if self.r.tcx.features().generic_const_exprs || is_trivial_const_arg { + ConstantHasGenerics::Yes + } else { + ConstantHasGenerics::No(NoConstantGenericsReason::NonTrivialConstArg) + } + } + }; + + self.with_constant_rib(is_repeat_expr, may_use_generics, None, |this| { + this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { + resolve_expr(this); + }); }); } @@ -4046,17 +4117,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { // Constant arguments need to be treated as AnonConst since // that is how they will be later lowered to HIR. if const_args.contains(&idx) { - self.with_constant_rib( - IsRepeatExpr::No, - if argument.is_potential_trivial_const_param() { - ConstantHasGenerics::Yes - } else { - ConstantHasGenerics::No - }, - None, - |this| { - this.resolve_expr(argument, None); - }, + self.resolve_anon_const_manual( + argument.is_potential_trivial_const_arg(), + AnonConstKind::ConstArg(IsRepeatExpr::No), + |this| this.resolve_expr(argument, None), ); } else { self.resolve_expr(argument, None); @@ -4115,14 +4179,10 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { } ExprKind::Repeat(ref elem, ref ct) => { self.visit_expr(elem); - self.with_lifetime_rib(LifetimeRibKind::AnonConst, |this| { - this.with_lifetime_rib(LifetimeRibKind::Elided(LifetimeRes::Infer), |this| { - this.resolve_anon_const(ct, IsRepeatExpr::Yes) - }) - }); + self.resolve_anon_const(ct, AnonConstKind::ConstArg(IsRepeatExpr::Yes)); } ExprKind::ConstBlock(ref ct) => { - self.resolve_inline_const(ct); + self.resolve_anon_const(ct, AnonConstKind::InlineConst); } ExprKind::Index(ref elem, ref idx) => { self.resolve_expr(elem, Some(expr)); From 73b3ce26ecf580aec44e45308e952753f5218e07 Mon Sep 17 00:00:00 2001 From: Boxy Date: Fri, 5 May 2023 21:42:51 +0100 Subject: [PATCH 39/97] improve diagnostics and bless tests --- compiler/rustc_resolve/messages.ftl | 29 +- compiler/rustc_resolve/src/diagnostics.rs | 19 +- compiler/rustc_resolve/src/errors.rs | 47 +++- compiler/rustc_resolve/src/ident.rs | 70 +++-- compiler/rustc_resolve/src/late.rs | 4 +- .../rustc_resolve/src/late/diagnostics.rs | 70 +++-- compiler/rustc_resolve/src/lib.rs | 11 +- .../assoc_const_as_type_argument.rs | 13 + .../assoc_const_as_type_argument.stderr | 21 ++ .../const-arg-in-const-arg.full.stderr | 163 ----------- .../const-arg-in-const-arg.min.stderr | 254 +++++++++--------- .../const-generics/const-arg-in-const-arg.rs | 60 ++--- ...st-argument-non-static-lifetime.min.stderr | 9 +- .../const-argument-non-static-lifetime.rs | 2 +- ...am-type-depends-on-const-param.full.stderr | 4 + ...ram-type-depends-on-const-param.min.stderr | 4 + ...-type-depends-on-type-param-ungated.stderr | 2 + ...ram-type-depends-on-type-param.full.stderr | 2 + ...aram-type-depends-on-type-param.min.stderr | 2 + .../generic_const_exprs/issue-74713.rs | 2 +- .../generic_const_exprs/issue-74713.stderr | 11 +- .../unresolved_lifetimes_error.rs | 12 + .../unresolved_lifetimes_error.stderr | 11 + tests/ui/const-generics/issue-46511.rs | 2 +- tests/ui/const-generics/issue-46511.stderr | 11 +- .../issues/issue-56445-1.full.stderr | 8 +- .../issues/issue-56445-1.min.stderr | 8 +- .../ui/const-generics/issues/issue-56445-1.rs | 2 +- .../issues/issue-62878.full.stderr | 2 + .../issues/issue-62878.min.stderr | 2 + .../issues/issue-71169.full.stderr | 2 + .../issues/issue-71169.min.stderr | 2 + .../issues/issue-71381.full.stderr | 4 + .../issues/issue-71381.min.stderr | 4 + .../issues/issue-71611.full.stderr | 2 + .../issues/issue-71611.min.stderr | 2 + tests/ui/const-generics/issues/issue-77357.rs | 11 - .../const-generics/issues/issue-77357.stderr | 11 - tests/ui/const-generics/issues/issue-83993.rs | 14 - .../const-generics/issues/issue-88997.stderr | 4 + .../const-generics/issues/issue-90364.stderr | 2 + .../late-bound-vars/in_closure.rs | 20 +- .../late-bound-vars/in_closure.stderr | 13 + .../const-generics/late-bound-vars/simple.rs | 19 +- .../late-bound-vars/simple.stderr | 13 + .../forbid-non-static-lifetimes.rs | 4 +- .../forbid-non-static-lifetimes.stderr | 17 +- ...outer-lifetime-in-const-generic-default.rs | 2 +- ...r-lifetime-in-const-generic-default.stderr | 8 +- ...ariant-discrimiant-no-generics.full.stderr | 34 +++ ...variant-discrimiant-no-generics.min.stderr | 34 +++ .../variant-discrimiant-no-generics.rs | 32 +++ .../issue-70453-generics-in-discr-ice-2.rs | 2 +- ...issue-70453-generics-in-discr-ice-2.stderr | 5 +- .../issue-70453-generics-in-discr-ice.rs | 2 +- .../issue-70453-generics-in-discr-ice.stderr | 5 +- .../issue-70453-polymorphic-ctfe.stderr | 5 +- tests/ui/enum/issue-67945-1.stderr | 5 +- tests/ui/enum/issue-67945-2.stderr | 5 +- tests/ui/error-codes/E0771.rs | 2 +- tests/ui/error-codes/E0771.stderr | 8 +- .../lifetimes/issue-64173-unused-lifetimes.rs | 2 +- .../issue-64173-unused-lifetimes.stderr | 11 +- .../ui/lifetimes/unusual-rib-combinations.rs | 2 +- .../lifetimes/unusual-rib-combinations.stderr | 8 +- 65 files changed, 668 insertions(+), 505 deletions(-) create mode 100644 tests/ui/const-generics/assoc_const_as_type_argument.rs create mode 100644 tests/ui/const-generics/assoc_const_as_type_argument.stderr delete mode 100644 tests/ui/const-generics/const-arg-in-const-arg.full.stderr create mode 100644 tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.rs create mode 100644 tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr delete mode 100644 tests/ui/const-generics/issues/issue-77357.rs delete mode 100644 tests/ui/const-generics/issues/issue-77357.stderr delete mode 100644 tests/ui/const-generics/issues/issue-83993.rs create mode 100644 tests/ui/const-generics/late-bound-vars/in_closure.stderr create mode 100644 tests/ui/const-generics/late-bound-vars/simple.stderr create mode 100644 tests/ui/const-generics/variant-discrimiant-no-generics.full.stderr create mode 100644 tests/ui/const-generics/variant-discrimiant-no-generics.min.stderr create mode 100644 tests/ui/const-generics/variant-discrimiant-no-generics.rs diff --git a/compiler/rustc_resolve/messages.ftl b/compiler/rustc_resolve/messages.ftl index 32409499047c..ff8bd462dd8d 100644 --- a/compiler/rustc_resolve/messages.ftl +++ b/compiler/rustc_resolve/messages.ftl @@ -145,6 +145,15 @@ resolve_param_in_ty_of_const_param = the type of const parameters must not depend on other generic parameters .label = the type must not depend on the parameter `{$name}` +resolve_type_param_in_ty_of_const_param = + type parameters may not be used in the type of const parameters + +resolve_const_param_in_ty_of_const_param = + const parameters may not be used in the type of const parameters + +resolve_lifetime_param_in_ty_of_const_param = + lifetime parameters may not be used in the type of const parameters + resolve_self_in_generic_param_default = generic parameters cannot use `Self` in their defaults .label = `Self` in generic parameter default @@ -156,12 +165,15 @@ resolve_param_in_non_trivial_anon_const = resolve_param_in_non_trivial_anon_const_help = use `#![feature(generic_const_exprs)]` to allow generic const expressions -resolve_param_in_non_trivial_anon_const_sub_type = +resolve_type_param_in_non_trivial_anon_const = type parameters may not be used in const expressions -resolve_param_in_non_trivial_anon_const_sub_non_type = +resolve_const_param_in_non_trivial_anon_const = const parameters may only be used as standalone arguments, i.e. `{$name}` +resolve_lifetime_param_in_non_trivial_anon_const = + lifetime parameters may not be used in const expressions + resolve_unreachable_label = use of unreachable label `{$name}` .label = unreachable label `{$name}` @@ -233,3 +245,16 @@ resolve_macro_use_extern_crate_self = `#[macro_use]` is not supported on `extern resolve_accessible_unsure = not sure whether the path is accessible or not .note = the type may have associated items, but we are currently not checking them + +resolve_param_in_enum_discriminant = + generic parameters may not be used in enum discriminant values + .label = cannot perform const operation using `{$name}` + +resolve_type_param_in_enum_discriminant = + type parameters may not be used in enum discriminant values + +resolve_const_param_in_enum_discriminant = + const parameters may not be used in enum discriminant values + +resolve_lifetime_param_in_enum_discriminant = + lifetime parameters may not be used in enum discriminant values diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index fae7d5495925..72cdce5c8f05 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -864,18 +864,15 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { ResolutionError::ForwardDeclaredGenericParam => { self.tcx.sess.create_err(errs::ForwardDeclaredGenericParam { span }) } - ResolutionError::ParamInTyOfConstParam(name) => { - self.tcx.sess.create_err(errs::ParamInTyOfConstParam { span, name }) - } - ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => { + ResolutionError::ParamInTyOfConstParam { name, param_kind: is_type } => self + .tcx + .sess + .create_err(errs::ParamInTyOfConstParam { span, name, param_kind: is_type }), + ResolutionError::ParamInNonTrivialAnonConst { name, param_kind: is_type } => { self.tcx.sess.create_err(errs::ParamInNonTrivialAnonConst { span, name, - sub_is_type: if is_type { - errs::ParamInNonTrivialAnonConstIsType::AType - } else { - errs::ParamInNonTrivialAnonConstIsType::NotAType { name } - }, + param_kind: is_type, help: self .tcx .sess @@ -883,6 +880,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { .then_some(errs::ParamInNonTrivialAnonConstHelp), }) } + ResolutionError::ParamInEnumDiscriminant { name, param_kind: is_type } => self + .tcx + .sess + .create_err(errs::ParamInEnumDiscriminant { span, name, param_kind: is_type }), ResolutionError::SelfInGenericParamDefault => { self.tcx.sess.create_err(errs::SelfInGenericParamDefault { span }) } diff --git a/compiler/rustc_resolve/src/errors.rs b/compiler/rustc_resolve/src/errors.rs index 4f9f1c7e8564..f6d7e8b4c873 100644 --- a/compiler/rustc_resolve/src/errors.rs +++ b/compiler/rustc_resolve/src/errors.rs @@ -326,6 +326,18 @@ pub(crate) struct ParamInTyOfConstParam { #[label] pub(crate) span: Span, pub(crate) name: Symbol, + #[subdiagnostic] + pub(crate) param_kind: Option, +} + +#[derive(Subdiagnostic)] +pub(crate) enum ParamKindInTyOfConstParam { + #[note(resolve_type_param_in_ty_of_const_param)] + Type, + #[note(resolve_const_param_in_ty_of_const_param)] + Const, + #[note(resolve_lifetime_param_in_ty_of_const_param)] + Lifetime, } #[derive(Diagnostic)] @@ -344,7 +356,7 @@ pub(crate) struct ParamInNonTrivialAnonConst { pub(crate) span: Span, pub(crate) name: Symbol, #[subdiagnostic] - pub(crate) sub_is_type: ParamInNonTrivialAnonConstIsType, + pub(crate) param_kind: ParamKindInNonTrivialAnonConst, #[subdiagnostic] pub(crate) help: Option, } @@ -354,11 +366,13 @@ pub(crate) struct ParamInNonTrivialAnonConst { pub(crate) struct ParamInNonTrivialAnonConstHelp; #[derive(Subdiagnostic)] -pub(crate) enum ParamInNonTrivialAnonConstIsType { - #[note(resolve_param_in_non_trivial_anon_const_sub_type)] - AType, - #[help(resolve_param_in_non_trivial_anon_const_sub_non_type)] - NotAType { name: Symbol }, +pub(crate) enum ParamKindInNonTrivialAnonConst { + #[note(resolve_type_param_in_non_trivial_anon_const)] + Type, + #[help(resolve_const_param_in_non_trivial_anon_const)] + Const { name: Symbol }, + #[note(resolve_lifetime_param_in_non_trivial_anon_const)] + Lifetime, } #[derive(Diagnostic)] @@ -539,3 +553,24 @@ pub(crate) struct CfgAccessibleUnsure { #[primary_span] pub(crate) span: Span, } + +#[derive(Diagnostic)] +#[diag(resolve_param_in_enum_discriminant)] +pub(crate) struct ParamInEnumDiscriminant { + #[primary_span] + #[label] + pub(crate) span: Span, + pub(crate) name: Symbol, + #[subdiagnostic] + pub(crate) param_kind: ParamKindInEnumDiscriminant, +} + +#[derive(Subdiagnostic)] +pub(crate) enum ParamKindInEnumDiscriminant { + #[note(resolve_type_param_in_enum_discriminant)] + Type, + #[note(resolve_const_param_in_enum_discriminant)] + Const, + #[note(resolve_lifetime_param_in_enum_discriminant)] + Lifetime, +} diff --git a/compiler/rustc_resolve/src/ident.rs b/compiler/rustc_resolve/src/ident.rs index 4e1d49c12a76..5a3ae656ad45 100644 --- a/compiler/rustc_resolve/src/ident.rs +++ b/compiler/rustc_resolve/src/ident.rs @@ -13,8 +13,10 @@ use rustc_span::{Span, DUMMY_SP}; use std::ptr; +use crate::errors::{ParamKindInEnumDiscriminant, ParamKindInNonTrivialAnonConst}; use crate::late::{ - ConstantHasGenerics, ConstantItemKind, HasGenericParams, PathSource, Rib, RibKind, + ConstantHasGenerics, ConstantItemKind, HasGenericParams, NoConstantGenericsReason, PathSource, + Rib, RibKind, }; use crate::macros::{sub_namespace_match, MacroRulesScope}; use crate::{errors, AmbiguityError, AmbiguityErrorMisc, AmbiguityKind, Determinacy, Finalize}; @@ -1153,7 +1155,13 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } RibKind::ConstParamTy => { if let Some(span) = finalize { - self.report_error(span, ParamInTyOfConstParam(rib_ident.name)); + self.report_error( + span, + ParamInTyOfConstParam { + name: rib_ident.name, + param_kind: None, + }, + ); } return Res::Err; } @@ -1206,13 +1214,22 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { } } else { if let Some(span) = finalize { - self.report_error( - span, - ResolutionError::ParamInNonTrivialAnonConst { - name: rib_ident.name, - is_type: true, - }, - ); + let error = match cause { + NoConstantGenericsReason::IsEnumDiscriminant => { + ResolutionError::ParamInEnumDiscriminant { + name: rib_ident.name, + param_kind: ParamKindInEnumDiscriminant::Type, + } + } + NoConstantGenericsReason::NonTrivialConstArg => { + ResolutionError::ParamInNonTrivialAnonConst { + name: rib_ident.name, + param_kind: + ParamKindInNonTrivialAnonConst::Type, + } + } + }; + self.report_error(span, error); self.tcx.sess.delay_span_bug(span, CG_BUG_STR); } @@ -1229,7 +1246,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if let Some(span) = finalize { self.report_error( span, - ResolutionError::ParamInTyOfConstParam(rib_ident.name), + ResolutionError::ParamInTyOfConstParam { + name: rib_ident.name, + param_kind: Some(errors::ParamKindInTyOfConstParam::Type), + }, ); } return Res::Err; @@ -1262,14 +1282,23 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { RibKind::ConstantItem(trivial, _) => { if let ConstantHasGenerics::No(cause) = trivial { if let Some(span) = finalize { - self.report_error( - span, - ResolutionError::ParamInNonTrivialAnonConst { - name: rib_ident.name, - is_type: false, - }, - ); - self.tcx.sess.delay_span_bug(span, CG_BUG_STR); + let error = match cause { + NoConstantGenericsReason::IsEnumDiscriminant => { + ResolutionError::ParamInEnumDiscriminant { + name: rib_ident.name, + param_kind: ParamKindInEnumDiscriminant::Const, + } + } + NoConstantGenericsReason::NonTrivialConstArg => { + ResolutionError::ParamInNonTrivialAnonConst { + name: rib_ident.name, + param_kind: ParamKindInNonTrivialAnonConst::Const { + name: rib_ident.name, + }, + } + } + }; + self.report_error(span, error); } return Res::Err; @@ -1283,7 +1312,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { if let Some(span) = finalize { self.report_error( span, - ResolutionError::ParamInTyOfConstParam(rib_ident.name), + ResolutionError::ParamInTyOfConstParam { + name: rib_ident.name, + param_kind: Some(errors::ParamKindInTyOfConstParam::Const), + }, ); } return Res::Err; diff --git a/compiler/rustc_resolve/src/late.rs b/compiler/rustc_resolve/src/late.rs index c6b193710e08..2a8287d5554f 100644 --- a/compiler/rustc_resolve/src/late.rs +++ b/compiler/rustc_resolve/src/late.rs @@ -1529,7 +1529,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { match rib.kind { LifetimeRibKind::Item => break, LifetimeRibKind::ConstParamTy => { - self.emit_non_static_lt_in_const_generic_error(lifetime); + self.emit_non_static_lt_in_const_param_ty_error(lifetime); self.record_lifetime_res( lifetime.id, LifetimeRes::Error, @@ -1538,7 +1538,7 @@ impl<'a: 'ast, 'b, 'ast, 'tcx> LateResolutionVisitor<'a, 'b, 'ast, 'tcx> { return; } LifetimeRibKind::ConcreteAnonConst(cause) => { - self.maybe_emit_forbidden_non_static_lifetime_error(lifetime); + self.emit_forbidden_non_static_lifetime_error(cause, lifetime); self.record_lifetime_res( lifetime.id, LifetimeRes::Error, diff --git a/compiler/rustc_resolve/src/late/diagnostics.rs b/compiler/rustc_resolve/src/late/diagnostics.rs index 42d498c7ee0b..c9131d8c8a91 100644 --- a/compiler/rustc_resolve/src/late/diagnostics.rs +++ b/compiler/rustc_resolve/src/late/diagnostics.rs @@ -1,7 +1,7 @@ use crate::diagnostics::{ImportSuggestion, LabelSuggestion, TypoSuggestion}; use crate::late::{AliasPossibility, LateResolutionVisitor, RibKind}; use crate::late::{LifetimeBinderKind, LifetimeRes, LifetimeRibKind, LifetimeUseSet}; -use crate::path_names_to_string; +use crate::{errors, path_names_to_string}; use crate::{Module, ModuleKind, ModuleOrUniformRoot}; use crate::{PathResult, PathSource, Segment}; @@ -22,7 +22,6 @@ use rustc_hir::def::{self, CtorKind, CtorOf, DefKind}; use rustc_hir::def_id::{DefId, CRATE_DEF_ID}; use rustc_hir::PrimTy; use rustc_session::lint; -use rustc_session::parse::feature_err; use rustc_session::Session; use rustc_span::edit_distance::find_best_match_for_name; use rustc_span::edition::Edition; @@ -35,6 +34,8 @@ use std::ops::Deref; use thin_vec::ThinVec; +use super::NoConstantGenericsReason; + type Res = def::Res; /// A field or associated item from self type suggested in case of resolution failure. @@ -2316,37 +2317,56 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> { } } - pub(crate) fn emit_non_static_lt_in_const_generic_error(&self, lifetime_ref: &ast::Lifetime) { - struct_span_err!( - self.r.tcx.sess, - lifetime_ref.ident.span, - E0771, - "use of non-static lifetime `{}` in const generic", - lifetime_ref.ident - ) - .note( - "for more information, see issue #74052 \ - ", - ) - .emit(); + pub(crate) fn emit_non_static_lt_in_const_param_ty_error(&self, lifetime_ref: &ast::Lifetime) { + self.r + .tcx + .sess + .create_err(errors::ParamInTyOfConstParam { + span: lifetime_ref.ident.span, + name: lifetime_ref.ident.name, + param_kind: Some(errors::ParamKindInTyOfConstParam::Lifetime), + }) + .emit(); } /// Non-static lifetimes are prohibited in anonymous constants under `min_const_generics`. /// This function will emit an error if `generic_const_exprs` is not enabled, the body identified by /// `body_id` is an anonymous constant and `lifetime_ref` is non-static. - pub(crate) fn maybe_emit_forbidden_non_static_lifetime_error( + pub(crate) fn emit_forbidden_non_static_lifetime_error( &self, + cause: NoConstantGenericsReason, lifetime_ref: &ast::Lifetime, ) { - let feature_active = self.r.tcx.sess.features_untracked().generic_const_exprs; - if !feature_active { - feature_err( - &self.r.tcx.sess.parse_sess, - sym::generic_const_exprs, - lifetime_ref.ident.span, - "a non-static lifetime is not allowed in a `const`", - ) - .emit(); + match cause { + NoConstantGenericsReason::IsEnumDiscriminant => { + self.r + .tcx + .sess + .create_err(errors::ParamInEnumDiscriminant { + span: lifetime_ref.ident.span, + name: lifetime_ref.ident.name, + param_kind: errors::ParamKindInEnumDiscriminant::Lifetime, + }) + .emit(); + } + NoConstantGenericsReason::NonTrivialConstArg => { + assert!(!self.r.tcx.features().generic_const_exprs); + self.r + .tcx + .sess + .create_err(errors::ParamInNonTrivialAnonConst { + span: lifetime_ref.ident.span, + name: lifetime_ref.ident.name, + param_kind: errors::ParamKindInNonTrivialAnonConst::Lifetime, + help: self + .r + .tcx + .sess + .is_nightly_build() + .then_some(errors::ParamInNonTrivialAnonConstHelp), + }) + .emit(); + } } } diff --git a/compiler/rustc_resolve/src/lib.rs b/compiler/rustc_resolve/src/lib.rs index e46463579fe4..590609f9ed3d 100644 --- a/compiler/rustc_resolve/src/lib.rs +++ b/compiler/rustc_resolve/src/lib.rs @@ -21,6 +21,9 @@ #[macro_use] extern crate tracing; +use errors::{ + ParamKindInEnumDiscriminant, ParamKindInNonTrivialAnonConst, ParamKindInTyOfConstParam, +}; use rustc_arena::{DroplessArena, TypedArena}; use rustc_ast::node_id::NodeMap; use rustc_ast::{self as ast, attr, NodeId, CRATE_NODE_ID}; @@ -223,11 +226,15 @@ enum ResolutionError<'a> { /// Error E0128: generic parameters with a default cannot use forward-declared identifiers. ForwardDeclaredGenericParam, /// ERROR E0770: the type of const parameters must not depend on other generic parameters. - ParamInTyOfConstParam(Symbol), + ParamInTyOfConstParam { name: Symbol, param_kind: Option }, /// generic parameters must not be used inside const evaluations. /// /// This error is only emitted when using `min_const_generics`. - ParamInNonTrivialAnonConst { name: Symbol, is_type: bool }, + ParamInNonTrivialAnonConst { name: Symbol, param_kind: ParamKindInNonTrivialAnonConst }, + /// generic parameters must not be used inside enum discriminants. + /// + /// This error is emitted even with `generic_const_exprs`. + ParamInEnumDiscriminant { name: Symbol, param_kind: ParamKindInEnumDiscriminant }, /// Error E0735: generic parameters with a default cannot use `Self` SelfInGenericParamDefault, /// Error E0767: use of unreachable label diff --git a/tests/ui/const-generics/assoc_const_as_type_argument.rs b/tests/ui/const-generics/assoc_const_as_type_argument.rs new file mode 100644 index 000000000000..ffc7f116a94e --- /dev/null +++ b/tests/ui/const-generics/assoc_const_as_type_argument.rs @@ -0,0 +1,13 @@ +trait Trait { + const ASSOC: usize; +} + +fn bar() {} + +fn foo() { + bar::<::ASSOC>(); + //~^ ERROR: expected associated type, found associated constant `Trait::ASSOC` + //~| ERROR: unresolved item provided when a constant was expected +} + +fn main() {} diff --git a/tests/ui/const-generics/assoc_const_as_type_argument.stderr b/tests/ui/const-generics/assoc_const_as_type_argument.stderr new file mode 100644 index 000000000000..ac0095461350 --- /dev/null +++ b/tests/ui/const-generics/assoc_const_as_type_argument.stderr @@ -0,0 +1,21 @@ +error[E0575]: expected associated type, found associated constant `Trait::ASSOC` + --> $DIR/assoc_const_as_type_argument.rs:8:11 + | +LL | bar::<::ASSOC>(); + | ^^^^^^^^^^^^^^^^^^^ not a associated type + +error[E0747]: unresolved item provided when a constant was expected + --> $DIR/assoc_const_as_type_argument.rs:8:11 + | +LL | bar::<::ASSOC>(); + | ^^^^^^^^^^^^^^^^^^^ + | +help: if this generic argument was intended as a const parameter, surround it with braces + | +LL | bar::<{ ::ASSOC }>(); + | + + + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0575, E0747. +For more information about an error, try `rustc --explain E0575`. diff --git a/tests/ui/const-generics/const-arg-in-const-arg.full.stderr b/tests/ui/const-generics/const-arg-in-const-arg.full.stderr deleted file mode 100644 index 463a37d7e3d1..000000000000 --- a/tests/ui/const-generics/const-arg-in-const-arg.full.stderr +++ /dev/null @@ -1,163 +0,0 @@ -error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:18:23 - | -LL | let _: [u8; faz::<'a>(&())]; - | ^^ - | -note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 - | -LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } - | ^^ - -error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:21:23 - | -LL | let _: [u8; faz::<'b>(&())]; - | ^^ - | -note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 - | -LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } - | ^^ - -error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:41:24 - | -LL | let _: Foo<{ faz::<'a>(&()) }>; - | ^^ - | -note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 - | -LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } - | ^^ - -error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:44:24 - | -LL | let _: Foo<{ faz::<'b>(&()) }>; - | ^^ - | -note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 - | -LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } - | ^^ - -error: unconstrained generic constant - --> $DIR/const-arg-in-const-arg.rs:13:12 - | -LL | let _: [u8; foo::()]; - | ^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); foo::()]:` - -error: unconstrained generic constant - --> $DIR/const-arg-in-const-arg.rs:15:12 - | -LL | let _: [u8; bar::()]; - | ^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); bar::()]:` - -error: unconstrained generic constant - --> $DIR/const-arg-in-const-arg.rs:36:12 - | -LL | let _: Foo<{ foo::() }>; - | ^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { foo::() }]:` - -error: unconstrained generic constant - --> $DIR/const-arg-in-const-arg.rs:38:12 - | -LL | let _: Foo<{ bar::() }>; - | ^^^^^^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { bar::() }]:` - -error: unconstrained generic constant - --> $DIR/const-arg-in-const-arg.rs:25:17 - | -LL | let _ = [0; foo::()]; - | ^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); foo::()]:` - -error: unconstrained generic constant - --> $DIR/const-arg-in-const-arg.rs:27:17 - | -LL | let _ = [0; bar::()]; - | ^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); bar::()]:` - -error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:30:23 - | -LL | let _ = [0; faz::<'a>(&())]; - | ^^ - | -note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 - | -LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } - | ^^ - -error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:33:23 - | -LL | let _ = [0; faz::<'b>(&())]; - | ^^ - | -note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 - | -LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } - | ^^ - -error: unconstrained generic constant - --> $DIR/const-arg-in-const-arg.rs:47:19 - | -LL | let _ = Foo::<{ foo::() }>; - | ^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { foo::() }]:` - -error: unconstrained generic constant - --> $DIR/const-arg-in-const-arg.rs:49:19 - | -LL | let _ = Foo::<{ bar::() }>; - | ^^^^^^^^^^^^^^ - | - = help: try adding a `where` bound using this expression: `where [(); { bar::() }]:` - -error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:52:27 - | -LL | let _ = Foo::<{ faz::<'a>(&()) }>; - | ^^ - | -note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 - | -LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } - | ^^ - -error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:55:27 - | -LL | let _ = Foo::<{ faz::<'b>(&()) }>; - | ^^ - | -note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 - | -LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } - | ^^ - -error: aborting due to 16 previous errors - -For more information about this error, try `rustc --explain E0794`. diff --git a/tests/ui/const-generics/const-arg-in-const-arg.min.stderr b/tests/ui/const-generics/const-arg-in-const-arg.min.stderr index a7bd9c62b0ee..f1f22e2342d4 100644 --- a/tests/ui/const-generics/const-arg-in-const-arg.min.stderr +++ b/tests/ui/const-generics/const-arg-in-const-arg.min.stderr @@ -1,5 +1,5 @@ error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:13:23 + --> $DIR/const-arg-in-const-arg.rs:15:23 | LL | let _: [u8; foo::()]; | ^ cannot perform const operation using `T` @@ -8,7 +8,7 @@ LL | let _: [u8; foo::()]; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:15:23 + --> $DIR/const-arg-in-const-arg.rs:16:23 | LL | let _: [u8; bar::()]; | ^ cannot perform const operation using `N` @@ -16,44 +16,44 @@ LL | let _: [u8; bar::()]; = help: const parameters may only be used as standalone arguments, i.e. `N` = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:18:23 | LL | let _: [u8; faz::<'a>(&())]; - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:20:23 | LL | let _: [u8; baz::<'a>(&())]; - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:21:23 | LL | let _: [u8; faz::<'b>(&())]; - | ^^ + | ^^ cannot perform const operation using `'b` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/const-arg-in-const-arg.rs:23:23 | LL | let _: [u8; baz::<'b>(&())]; - | ^^ + | ^^ cannot perform const operation using `'b` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:27:23 + --> $DIR/const-arg-in-const-arg.rs:26:23 | LL | let _ = [0; bar::()]; | ^ cannot perform const operation using `N` @@ -61,44 +61,44 @@ LL | let _ = [0; bar::()]; = help: const parameters may only be used as standalone arguments, i.e. `N` = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:30:23 +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:28:23 | LL | let _ = [0; faz::<'a>(&())]; - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable - -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:32:23 - | -LL | let _ = [0; baz::<'a>(&())]; - | ^^ - | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable - -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:33:23 - | -LL | let _ = [0; faz::<'b>(&())]; - | ^^ - | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable - -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:35:23 - | -LL | let _ = [0; baz::<'b>(&())]; - | ^^ - | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:36:24 + --> $DIR/const-arg-in-const-arg.rs:30:23 + | +LL | let _ = [0; baz::<'a>(&())]; + | ^^ cannot perform const operation using `'a` + | + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:31:23 + | +LL | let _ = [0; faz::<'b>(&())]; + | ^^ cannot perform const operation using `'b` + | + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:33:23 + | +LL | let _ = [0; baz::<'b>(&())]; + | ^^ cannot perform const operation using `'b` + | + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:34:24 | LL | let _: Foo<{ foo::() }>; | ^ cannot perform const operation using `T` @@ -107,7 +107,7 @@ LL | let _: Foo<{ foo::() }>; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:38:24 + --> $DIR/const-arg-in-const-arg.rs:35:24 | LL | let _: Foo<{ bar::() }>; | ^ cannot perform const operation using `N` @@ -115,44 +115,44 @@ LL | let _: Foo<{ bar::() }>; = help: const parameters may only be used as standalone arguments, i.e. `N` = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:41:24 +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:37:24 | LL | let _: Foo<{ faz::<'a>(&()) }>; - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable - -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:43:24 - | -LL | let _: Foo<{ baz::<'a>(&()) }>; - | ^^ - | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable - -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:44:24 - | -LL | let _: Foo<{ faz::<'b>(&()) }>; - | ^^ - | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable - -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:46:24 - | -LL | let _: Foo<{ baz::<'b>(&()) }>; - | ^^ - | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:47:27 + --> $DIR/const-arg-in-const-arg.rs:39:24 + | +LL | let _: Foo<{ baz::<'a>(&()) }>; + | ^^ cannot perform const operation using `'a` + | + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:40:24 + | +LL | let _: Foo<{ faz::<'b>(&()) }>; + | ^^ cannot perform const operation using `'b` + | + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:42:24 + | +LL | let _: Foo<{ baz::<'b>(&()) }>; + | ^^ cannot perform const operation using `'b` + | + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:43:27 | LL | let _ = Foo::<{ foo::() }>; | ^ cannot perform const operation using `T` @@ -161,7 +161,7 @@ LL | let _ = Foo::<{ foo::() }>; = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic parameters may not be used in const operations - --> $DIR/const-arg-in-const-arg.rs:49:27 + --> $DIR/const-arg-in-const-arg.rs:44:27 | LL | let _ = Foo::<{ bar::() }>; | ^ cannot perform const operation using `N` @@ -169,44 +169,44 @@ LL | let _ = Foo::<{ bar::() }>; = help: const parameters may only be used as standalone arguments, i.e. `N` = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:52:27 +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:46:27 | LL | let _ = Foo::<{ faz::<'a>(&()) }>; - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:54:27 +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:48:27 | LL | let _ = Foo::<{ baz::<'a>(&()) }>; - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:55:27 +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:49:27 | LL | let _ = Foo::<{ faz::<'b>(&()) }>; - | ^^ + | ^^ cannot perform const operation using `'b` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` - --> $DIR/const-arg-in-const-arg.rs:57:27 +error: generic parameters may not be used in const operations + --> $DIR/const-arg-in-const-arg.rs:51:27 | LL | let _ = Foo::<{ baz::<'b>(&()) }>; - | ^^ + | ^^ cannot perform const operation using `'b` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error[E0747]: unresolved item provided when a constant was expected - --> $DIR/const-arg-in-const-arg.rs:15:23 + --> $DIR/const-arg-in-const-arg.rs:16:23 | LL | let _: [u8; bar::()]; | ^ @@ -223,7 +223,7 @@ LL | let _: [u8; faz::<'a>(&())]; | ^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 + --> $DIR/const-arg-in-const-arg.rs:10:14 | LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ @@ -235,13 +235,13 @@ LL | let _: [u8; faz::<'b>(&())]; | ^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 + --> $DIR/const-arg-in-const-arg.rs:10:14 | LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0747]: unresolved item provided when a constant was expected - --> $DIR/const-arg-in-const-arg.rs:38:24 + --> $DIR/const-arg-in-const-arg.rs:35:24 | LL | let _: Foo<{ bar::() }>; | ^ @@ -252,25 +252,25 @@ LL | let _: Foo<{ bar::<{ N }>() }>; | + + error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:41:24 + --> $DIR/const-arg-in-const-arg.rs:37:24 | LL | let _: Foo<{ faz::<'a>(&()) }>; | ^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 + --> $DIR/const-arg-in-const-arg.rs:10:14 | LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:44:24 + --> $DIR/const-arg-in-const-arg.rs:40:24 | LL | let _: Foo<{ faz::<'b>(&()) }>; | ^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 + --> $DIR/const-arg-in-const-arg.rs:10:14 | LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ @@ -284,7 +284,7 @@ LL | let _ = [0; foo::()]; = note: this may fail depending on what value the parameter takes error[E0747]: unresolved item provided when a constant was expected - --> $DIR/const-arg-in-const-arg.rs:27:23 + --> $DIR/const-arg-in-const-arg.rs:26:23 | LL | let _ = [0; bar::()]; | ^ @@ -295,31 +295,31 @@ LL | let _ = [0; bar::<{ N }>()]; | + + error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:30:23 + --> $DIR/const-arg-in-const-arg.rs:28:23 | LL | let _ = [0; faz::<'a>(&())]; | ^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 + --> $DIR/const-arg-in-const-arg.rs:10:14 | LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:33:23 + --> $DIR/const-arg-in-const-arg.rs:31:23 | LL | let _ = [0; faz::<'b>(&())]; | ^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 + --> $DIR/const-arg-in-const-arg.rs:10:14 | LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0747]: unresolved item provided when a constant was expected - --> $DIR/const-arg-in-const-arg.rs:49:27 + --> $DIR/const-arg-in-const-arg.rs:44:27 | LL | let _ = Foo::<{ bar::() }>; | ^ @@ -330,30 +330,30 @@ LL | let _ = Foo::<{ bar::<{ N }>() }>; | + + error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:52:27 + --> $DIR/const-arg-in-const-arg.rs:46:27 | LL | let _ = Foo::<{ faz::<'a>(&()) }>; | ^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 + --> $DIR/const-arg-in-const-arg.rs:10:14 | LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error[E0794]: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present - --> $DIR/const-arg-in-const-arg.rs:55:27 + --> $DIR/const-arg-in-const-arg.rs:49:27 | LL | let _ = Foo::<{ faz::<'b>(&()) }>; | ^^ | note: the late bound lifetime parameter is introduced here - --> $DIR/const-arg-in-const-arg.rs:8:14 + --> $DIR/const-arg-in-const-arg.rs:10:14 | LL | const fn faz<'a>(_: &'a ()) -> usize { 13 } | ^^ error: aborting due to 36 previous errors -Some errors have detailed explanations: E0658, E0747, E0794. -For more information about an error, try `rustc --explain E0658`. +Some errors have detailed explanations: E0747, E0794. +For more information about an error, try `rustc --explain E0747`. diff --git a/tests/ui/const-generics/const-arg-in-const-arg.rs b/tests/ui/const-generics/const-arg-in-const-arg.rs index 44a4f560a248..9eaa54347f18 100644 --- a/tests/ui/const-generics/const-arg-in-const-arg.rs +++ b/tests/ui/const-generics/const-arg-in-const-arg.rs @@ -1,4 +1,6 @@ -// revisions: full min +// revisions: min +// we use a single revision because t his shoudl have a `full` revision +// but right now that ICEs and I(@BoxyUwU) could not get stderr normalization to work #![cfg_attr(full, feature(generic_const_exprs))] #![cfg_attr(full, allow(incomplete_features))] @@ -11,50 +13,42 @@ const fn baz<'a>(_: &'a ()) -> usize where &'a (): Sized { 13 } struct Foo; fn test<'a, 'b, T, const N: usize>() where &'b (): Sized { let _: [u8; foo::()]; //[min]~ ERROR generic parameters may not - //[full]~^ ERROR unconstrained generic constant let _: [u8; bar::()]; //[min]~ ERROR generic parameters may not //[min]~^ ERROR unresolved item provided when a constant was expected - //[full]~^^ ERROR unconstrained generic constant - let _: [u8; faz::<'a>(&())]; //[min]~ ERROR a non-static lifetime - //~^ ERROR cannot specify lifetime arguments - let _: [u8; baz::<'a>(&())]; //[min]~ ERROR a non-static lifetime - let _: [u8; faz::<'b>(&())]; //[min]~ ERROR a non-static lifetime - //~^ ERROR cannot specify lifetime arguments - let _: [u8; baz::<'b>(&())]; //[min]~ ERROR a non-static lifetime + let _: [u8; faz::<'a>(&())]; //[min]~ ERROR generic parameters may not + //[min]~^ ERROR cannot specify lifetime arguments + let _: [u8; baz::<'a>(&())]; //[min]~ ERROR generic parameters may not + let _: [u8; faz::<'b>(&())]; //[min]~ ERROR generic parameters may not + //[min]~^ ERROR cannot specify lifetime arguments + let _: [u8; baz::<'b>(&())]; //[min]~ ERROR generic parameters may not let _ = [0; foo::()]; //[min]~ ERROR constant expression depends on a generic parameter - //[full]~^ ERROR unconstrained generic constant let _ = [0; bar::()]; //[min]~ ERROR generic parameters may not //[min]~^ ERROR unresolved item provided when a constant was expected - //[full]~^^ ERROR unconstrained generic constant - let _ = [0; faz::<'a>(&())]; //[min]~ ERROR a non-static lifetime - //~^ ERROR cannot specify lifetime arguments - let _ = [0; baz::<'a>(&())]; //[min]~ ERROR a non-static lifetime - let _ = [0; faz::<'b>(&())]; //[min]~ ERROR a non-static lifetime - //~^ ERROR cannot specify lifetime arguments - let _ = [0; baz::<'b>(&())]; //[min]~ ERROR a non-static lifetime + let _ = [0; faz::<'a>(&())]; //[min]~ ERROR generic parameters may not + //[min]~^ ERROR cannot specify lifetime arguments + let _ = [0; baz::<'a>(&())]; //[min]~ ERROR generic parameters may not + let _ = [0; faz::<'b>(&())]; //[min]~ ERROR generic parameters may not + //[min]~^ ERROR cannot specify lifetime arguments + let _ = [0; baz::<'b>(&())]; //[min]~ ERROR generic parameters may not let _: Foo<{ foo::() }>; //[min]~ ERROR generic parameters may not - //[full]~^ ERROR unconstrained generic constant let _: Foo<{ bar::() }>; //[min]~ ERROR generic parameters may not //[min]~^ ERROR unresolved item provided when a constant was expected - //[full]~^^ ERROR unconstrained generic constant - let _: Foo<{ faz::<'a>(&()) }>; //[min]~ ERROR a non-static lifetime - //~^ ERROR cannot specify lifetime arguments - let _: Foo<{ baz::<'a>(&()) }>; //[min]~ ERROR a non-static lifetime - let _: Foo<{ faz::<'b>(&()) }>; //[min]~ ERROR a non-static lifetime - //~^ ERROR cannot specify lifetime arguments - let _: Foo<{ baz::<'b>(&()) }>; //[min]~ ERROR a non-static lifetime + let _: Foo<{ faz::<'a>(&()) }>; //[min]~ ERROR generic parameters may not + //[min]~^ ERROR cannot specify lifetime arguments + let _: Foo<{ baz::<'a>(&()) }>; //[min]~ ERROR generic parameters may not + let _: Foo<{ faz::<'b>(&()) }>; //[min]~ ERROR generic parameters may not + //[min]~^ ERROR cannot specify lifetime arguments + let _: Foo<{ baz::<'b>(&()) }>; //[min]~ ERROR generic parameters may not let _ = Foo::<{ foo::() }>; //[min]~ ERROR generic parameters may not - //[full]~^ ERROR unconstrained generic constant let _ = Foo::<{ bar::() }>; //[min]~ ERROR generic parameters may not //[min]~^ ERROR unresolved item provided when a constant was expected - //[full]~^^ ERROR unconstrained generic constant - let _ = Foo::<{ faz::<'a>(&()) }>; //[min]~ ERROR a non-static lifetime - //~^ ERROR cannot specify lifetime arguments - let _ = Foo::<{ baz::<'a>(&()) }>; //[min]~ ERROR a non-static lifetime - let _ = Foo::<{ faz::<'b>(&()) }>; //[min]~ ERROR a non-static lifetime - //~^ ERROR cannot specify lifetime arguments - let _ = Foo::<{ baz::<'b>(&()) }>; //[min]~ ERROR a non-static lifetime + let _ = Foo::<{ faz::<'a>(&()) }>; //[min]~ ERROR generic parameters may not + //[min]~^ ERROR cannot specify lifetime arguments + let _ = Foo::<{ baz::<'a>(&()) }>; //[min]~ ERROR generic parameters may not + let _ = Foo::<{ faz::<'b>(&()) }>; //[min]~ ERROR generic parameters may not + //[min]~^ ERROR cannot specify lifetime arguments + let _ = Foo::<{ baz::<'b>(&()) }>; //[min]~ ERROR generic parameters may not } fn main() {} diff --git a/tests/ui/const-generics/const-argument-non-static-lifetime.min.stderr b/tests/ui/const-generics/const-argument-non-static-lifetime.min.stderr index 82030731cc17..310ca75fdc90 100644 --- a/tests/ui/const-generics/const-argument-non-static-lifetime.min.stderr +++ b/tests/ui/const-generics/const-argument-non-static-lifetime.min.stderr @@ -1,12 +1,11 @@ -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/const-argument-non-static-lifetime.rs:14:17 | LL | let _: &'a (); - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/const-generics/const-argument-non-static-lifetime.rs b/tests/ui/const-generics/const-argument-non-static-lifetime.rs index 0357e4ed59fd..df2f3b7918cf 100644 --- a/tests/ui/const-generics/const-argument-non-static-lifetime.rs +++ b/tests/ui/const-generics/const-argument-non-static-lifetime.rs @@ -11,7 +11,7 @@ fn test() {} fn wow<'a>() -> &'a () { test::<{ - let _: &'a (); //[min]~ ERROR a non-static lifetime + let _: &'a (); //[min]~ ERROR generic parameters may not be used in const operations 3 }>(); &() diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr b/tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr index f639e276f466..539d840f0a80 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.full.stderr @@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Dependent([(); N]); | ^ the type must not depend on the parameter `N` + | + = note: const parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/const-param-type-depends-on-const-param.rs:15:40 | LL | pub struct SelfDependent; | ^ the type must not depend on the parameter `N` + | + = note: const parameters may not be used in the type of const parameters error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr index 24aa405211f4..f829526ca1dc 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-const-param.min.stderr @@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Dependent([(); N]); | ^ the type must not depend on the parameter `N` + | + = note: const parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/const-param-type-depends-on-const-param.rs:15:40 | LL | pub struct SelfDependent; | ^ the type must not depend on the parameter `N` + | + = note: const parameters may not be used in the type of const parameters error: `[u8; N]` is forbidden as the type of a const generic parameter --> $DIR/const-param-type-depends-on-const-param.rs:11:47 diff --git a/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr b/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr index 9c5c97befd83..c5160d1c3848 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-type-param-ungated.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | struct B(PhantomData<[T; N]>); | ^ the type must not depend on the parameter `T` + | + = note: type parameters may not be used in the type of const parameters error: aborting due to previous error diff --git a/tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr b/tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr index 32f7dea82639..938fb08b7956 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-type-param.full.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Dependent([(); X]); | ^ the type must not depend on the parameter `T` + | + = note: type parameters may not be used in the type of const parameters error[E0392]: parameter `T` is never used --> $DIR/const-param-type-depends-on-type-param.rs:11:22 diff --git a/tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr b/tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr index 32f7dea82639..938fb08b7956 100644 --- a/tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr +++ b/tests/ui/const-generics/const-param-type-depends-on-type-param.min.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Dependent([(); X]); | ^ the type must not depend on the parameter `T` + | + = note: type parameters may not be used in the type of const parameters error[E0392]: parameter `T` is never used --> $DIR/const-param-type-depends-on-type-param.rs:11:22 diff --git a/tests/ui/const-generics/generic_const_exprs/issue-74713.rs b/tests/ui/const-generics/generic_const_exprs/issue-74713.rs index 0bcb997d96cd..205d031d4a31 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-74713.rs +++ b/tests/ui/const-generics/generic_const_exprs/issue-74713.rs @@ -1,7 +1,7 @@ fn bug<'a>() where [(); { //~ ERROR mismatched types - let _: &'a (); //~ ERROR a non-static lifetime is not allowed in a `const` + let _: &'a (); //~ ERROR generic parameters may not be used in const operations }]: {} diff --git a/tests/ui/const-generics/generic_const_exprs/issue-74713.stderr b/tests/ui/const-generics/generic_const_exprs/issue-74713.stderr index e7673df0a025..f0e0a4b97110 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-74713.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-74713.stderr @@ -1,11 +1,11 @@ -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/issue-74713.rs:4:17 | LL | let _: &'a (); - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error[E0308]: mismatched types --> $DIR/issue-74713.rs:3:10 @@ -18,5 +18,4 @@ LL | | }]: error: aborting due to 2 previous errors -Some errors have detailed explanations: E0308, E0658. -For more information about an error, try `rustc --explain E0308`. +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.rs b/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.rs new file mode 100644 index 000000000000..96aeec77c130 --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.rs @@ -0,0 +1,12 @@ +#![feature(generic_const_exprs)] +#![allow(incomplete_features)] + +fn foo() -> [(); { + let a: &'a (); + //~^ ERROR: use of undeclared lifetime name `'a` + 10_usize +}] { + loop {} +} + +fn main() {} diff --git a/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr b/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr new file mode 100644 index 000000000000..976f037062dd --- /dev/null +++ b/tests/ui/const-generics/generic_const_exprs/unresolved_lifetimes_error.stderr @@ -0,0 +1,11 @@ +error[E0261]: use of undeclared lifetime name `'a` + --> $DIR/unresolved_lifetimes_error.rs:5:13 + | +LL | fn foo() -> [(); { + | - help: consider introducing lifetime `'a` here: `<'a>` +LL | let a: &'a (); + | ^^ undeclared lifetime + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0261`. diff --git a/tests/ui/const-generics/issue-46511.rs b/tests/ui/const-generics/issue-46511.rs index 71c50e2f3f7f..78baba818ad7 100644 --- a/tests/ui/const-generics/issue-46511.rs +++ b/tests/ui/const-generics/issue-46511.rs @@ -2,7 +2,7 @@ struct Foo<'a> //~ ERROR parameter `'a` is never used [E0392] { - _a: [u8; std::mem::size_of::<&'a mut u8>()] //~ ERROR a non-static lifetime is not allowed in a `const` + _a: [u8; std::mem::size_of::<&'a mut u8>()] //~ ERROR generic parameters may not be used in const operations } pub fn main() {} diff --git a/tests/ui/const-generics/issue-46511.stderr b/tests/ui/const-generics/issue-46511.stderr index b21afa56dcbf..58c93a1fab49 100644 --- a/tests/ui/const-generics/issue-46511.stderr +++ b/tests/ui/const-generics/issue-46511.stderr @@ -1,11 +1,11 @@ -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/issue-46511.rs:5:35 | LL | _a: [u8; std::mem::size_of::<&'a mut u8>()] - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error[E0392]: parameter `'a` is never used --> $DIR/issue-46511.rs:3:12 @@ -17,5 +17,4 @@ LL | struct Foo<'a> error: aborting due to 2 previous errors -Some errors have detailed explanations: E0392, E0658. -For more information about an error, try `rustc --explain E0392`. +For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/const-generics/issues/issue-56445-1.full.stderr b/tests/ui/const-generics/issues/issue-56445-1.full.stderr index 179643a75529..5fc0ec260474 100644 --- a/tests/ui/const-generics/issues/issue-56445-1.full.stderr +++ b/tests/ui/const-generics/issues/issue-56445-1.full.stderr @@ -1,11 +1,11 @@ -error[E0771]: use of non-static lifetime `'a` in const generic +error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/issue-56445-1.rs:9:26 | LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); - | ^^ + | ^^ the type must not depend on the parameter `'a` | - = note: for more information, see issue #74052 + = note: lifetime parameters may not be used in the type of const parameters error: aborting due to previous error -For more information about this error, try `rustc --explain E0771`. +For more information about this error, try `rustc --explain E0770`. diff --git a/tests/ui/const-generics/issues/issue-56445-1.min.stderr b/tests/ui/const-generics/issues/issue-56445-1.min.stderr index 9f8801341624..71a7051f25bf 100644 --- a/tests/ui/const-generics/issues/issue-56445-1.min.stderr +++ b/tests/ui/const-generics/issues/issue-56445-1.min.stderr @@ -1,10 +1,10 @@ -error[E0771]: use of non-static lifetime `'a` in const generic +error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/issue-56445-1.rs:9:26 | LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); - | ^^ + | ^^ the type must not depend on the parameter `'a` | - = note: for more information, see issue #74052 + = note: lifetime parameters may not be used in the type of const parameters error: `&str` is forbidden as the type of a const generic parameter --> $DIR/issue-56445-1.rs:9:25 @@ -17,4 +17,4 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0771`. +For more information about this error, try `rustc --explain E0770`. diff --git a/tests/ui/const-generics/issues/issue-56445-1.rs b/tests/ui/const-generics/issues/issue-56445-1.rs index 0741c3796ada..d862bf24aef7 100644 --- a/tests/ui/const-generics/issues/issue-56445-1.rs +++ b/tests/ui/const-generics/issues/issue-56445-1.rs @@ -7,7 +7,7 @@ use std::marker::PhantomData; struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>); -//~^ ERROR: use of non-static lifetime `'a` in const generic +//~^ ERROR: the type of const parameters must not depend on other generic parameters //[min]~| ERROR: `&str` is forbidden as the type of a const generic parameter impl Bug<'_, ""> {} diff --git a/tests/ui/const-generics/issues/issue-62878.full.stderr b/tests/ui/const-generics/issues/issue-62878.full.stderr index 3a2b291d7ba1..c658b5a6e686 100644 --- a/tests/ui/const-generics/issues/issue-62878.full.stderr +++ b/tests/ui/const-generics/issues/issue-62878.full.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn foo() {} | ^ the type must not depend on the parameter `N` + | + = note: const parameters may not be used in the type of const parameters error: aborting due to previous error diff --git a/tests/ui/const-generics/issues/issue-62878.min.stderr b/tests/ui/const-generics/issues/issue-62878.min.stderr index 5a721720d78b..9c0e5179cc4c 100644 --- a/tests/ui/const-generics/issues/issue-62878.min.stderr +++ b/tests/ui/const-generics/issues/issue-62878.min.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn foo() {} | ^ the type must not depend on the parameter `N` + | + = note: const parameters may not be used in the type of const parameters error: `[u8; N]` is forbidden as the type of a const generic parameter --> $DIR/issue-62878.rs:5:33 diff --git a/tests/ui/const-generics/issues/issue-71169.full.stderr b/tests/ui/const-generics/issues/issue-71169.full.stderr index 1f5880f368ee..ccdfbbd54cfb 100644 --- a/tests/ui/const-generics/issues/issue-71169.full.stderr +++ b/tests/ui/const-generics/issues/issue-71169.full.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn foo() {} | ^^^ the type must not depend on the parameter `LEN` + | + = note: const parameters may not be used in the type of const parameters error: aborting due to previous error diff --git a/tests/ui/const-generics/issues/issue-71169.min.stderr b/tests/ui/const-generics/issues/issue-71169.min.stderr index 998b16a79e63..ebfb24bec28d 100644 --- a/tests/ui/const-generics/issues/issue-71169.min.stderr +++ b/tests/ui/const-generics/issues/issue-71169.min.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn foo() {} | ^^^ the type must not depend on the parameter `LEN` + | + = note: const parameters may not be used in the type of const parameters error: `[u8; LEN]` is forbidden as the type of a const generic parameter --> $DIR/issue-71169.rs:5:38 diff --git a/tests/ui/const-generics/issues/issue-71381.full.stderr b/tests/ui/const-generics/issues/issue-71381.full.stderr index e17cf96aa3e3..962eaf75b98f 100644 --- a/tests/ui/const-generics/issues/issue-71381.full.stderr +++ b/tests/ui/const-generics/issues/issue-71381.full.stderr @@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub fn call_me(&self) { | ^^^^ the type must not depend on the parameter `Args` + | + = note: type parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/issue-71381.rs:23:40 | LL | const FN: unsafe extern "C" fn(Args), | ^^^^ the type must not depend on the parameter `Args` + | + = note: type parameters may not be used in the type of const parameters error[E0741]: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:14:61 diff --git a/tests/ui/const-generics/issues/issue-71381.min.stderr b/tests/ui/const-generics/issues/issue-71381.min.stderr index 3950317b3705..e1e140071fc1 100644 --- a/tests/ui/const-generics/issues/issue-71381.min.stderr +++ b/tests/ui/const-generics/issues/issue-71381.min.stderr @@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub fn call_me(&self) { | ^^^^ the type must not depend on the parameter `Args` + | + = note: type parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/issue-71381.rs:23:40 | LL | const FN: unsafe extern "C" fn(Args), | ^^^^ the type must not depend on the parameter `Args` + | + = note: type parameters may not be used in the type of const parameters error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71381.rs:14:61 diff --git a/tests/ui/const-generics/issues/issue-71611.full.stderr b/tests/ui/const-generics/issues/issue-71611.full.stderr index 656aa29e19b2..e109459f2be6 100644 --- a/tests/ui/const-generics/issues/issue-71611.full.stderr +++ b/tests/ui/const-generics/issues/issue-71611.full.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn func(outer: A) { | ^ the type must not depend on the parameter `A` + | + = note: type parameters may not be used in the type of const parameters error[E0741]: using function pointers as const generic parameters is forbidden --> $DIR/issue-71611.rs:5:21 diff --git a/tests/ui/const-generics/issues/issue-71611.min.stderr b/tests/ui/const-generics/issues/issue-71611.min.stderr index 01a85b745ce3..b33d7cf9850f 100644 --- a/tests/ui/const-generics/issues/issue-71611.min.stderr +++ b/tests/ui/const-generics/issues/issue-71611.min.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | fn func(outer: A) { | ^ the type must not depend on the parameter `A` + | + = note: type parameters may not be used in the type of const parameters error: using function pointers as const generic parameters is forbidden --> $DIR/issue-71611.rs:5:21 diff --git a/tests/ui/const-generics/issues/issue-77357.rs b/tests/ui/const-generics/issues/issue-77357.rs deleted file mode 100644 index 3cb8d3846ab7..000000000000 --- a/tests/ui/const-generics/issues/issue-77357.rs +++ /dev/null @@ -1,11 +0,0 @@ -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -trait MyTrait {} - -fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> { - //~^ ERROR overly complex generic constant - todo!() -} - -fn main() {} diff --git a/tests/ui/const-generics/issues/issue-77357.stderr b/tests/ui/const-generics/issues/issue-77357.stderr deleted file mode 100644 index 68b35a38b0f8..000000000000 --- a/tests/ui/const-generics/issues/issue-77357.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: overly complex generic constant - --> $DIR/issue-77357.rs:6:46 - | -LL | fn bug<'a, T>() -> &'static dyn MyTrait<[(); { |x: &'a u32| { x }; 4 }]> { - | ^^^^^^^^^^^^^^^^^^^^^^^^^ blocks are not supported in generic constants - | - = help: consider moving this anonymous constant into a `const` function - = note: this operation may be supported in the future - -error: aborting due to previous error - diff --git a/tests/ui/const-generics/issues/issue-83993.rs b/tests/ui/const-generics/issues/issue-83993.rs deleted file mode 100644 index f2f05d9526bc..000000000000 --- a/tests/ui/const-generics/issues/issue-83993.rs +++ /dev/null @@ -1,14 +0,0 @@ -// check-pass - -#![feature(generic_const_exprs)] -#![allow(incomplete_features)] - -fn bug<'a>() -where - for<'b> [(); { - let x: &'b (); - 0 - }]: -{} - -fn main() {} diff --git a/tests/ui/const-generics/issues/issue-88997.stderr b/tests/ui/const-generics/issues/issue-88997.stderr index 505ba0da2321..b49d52dd0bab 100644 --- a/tests/ui/const-generics/issues/issue-88997.stderr +++ b/tests/ui/const-generics/issues/issue-88997.stderr @@ -3,12 +3,16 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | struct Range(T) | ^ the type must not depend on the parameter `T` + | + = note: type parameters may not be used in the type of const parameters error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/issue-88997.rs:8:54 | LL | struct Range(T) | ^ the type must not depend on the parameter `T` + | + = note: type parameters may not be used in the type of const parameters error: aborting due to 2 previous errors diff --git a/tests/ui/const-generics/issues/issue-90364.stderr b/tests/ui/const-generics/issues/issue-90364.stderr index e85bd136ef6d..23424d7b919b 100644 --- a/tests/ui/const-generics/issues/issue-90364.stderr +++ b/tests/ui/const-generics/issues/issue-90364.stderr @@ -3,6 +3,8 @@ error[E0770]: the type of const parameters must not depend on other generic para | LL | pub struct Foo(T) | ^ the type must not depend on the parameter `T` + | + = note: type parameters may not be used in the type of const parameters error: aborting due to previous error diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.rs b/tests/ui/const-generics/late-bound-vars/in_closure.rs index 5294cc3b5f42..00fb535f0487 100644 --- a/tests/ui/const-generics/late-bound-vars/in_closure.rs +++ b/tests/ui/const-generics/late-bound-vars/in_closure.rs @@ -1,4 +1,22 @@ -// run-pass +// failure-status: 101 +// known-bug: unknown +// error-pattern:internal compiler error +// normalize-stderr-test "internal compiler error.*" -> "" +// normalize-stderr-test "DefId\([^)]*\)" -> "..." +// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" +// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" +// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" +// normalize-stderr-test "note: compiler flags.*\n\n" -> "" +// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" +// normalize-stderr-test "thread.*panicked.*\n" -> "" +// normalize-stderr-test "stack backtrace:\n" -> "" +// normalize-stderr-test "\s\d{1,}: .*\n" -> "" +// normalize-stderr-test "\s at .*\n" -> "" +// normalize-stderr-test ".*note: Some details.*\n" -> "" +// normalize-stderr-test "\n\n[ ]*\n" -> "" +// normalize-stderr-test "compiler/.*: projection" -> "projection" +// this should run-pass + #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/ui/const-generics/late-bound-vars/in_closure.stderr b/tests/ui/const-generics/late-bound-vars/in_closure.stderr new file mode 100644 index 000000000000..557fbea2e056 --- /dev/null +++ b/tests/ui/const-generics/late-bound-vars/in_closure.stderr @@ -0,0 +1,13 @@ +error: query stack during panic: +#0 [mir_borrowck] borrow-checking `test::{closure#0}::{constant#1}` +#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{closure#0}::{constant#1}` +#2 [mir_for_ctfe] caching mir of `test::{closure#0}::{constant#1}` for CTFE +#3 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}` +#4 [eval_to_allocation_raw] const-evaluating + checking `test::{closure#0}::{constant#1}` +#5 [eval_to_valtree] evaluating type-level constant +#6 [typeck] type-checking `test` +#7 [used_trait_imports] finding used_trait_imports `test` +#8 [analysis] running analysis passes on this crate +end of query stack +error: aborting due to previous error + diff --git a/tests/ui/const-generics/late-bound-vars/simple.rs b/tests/ui/const-generics/late-bound-vars/simple.rs index 6da5395ef83c..5d19aaf0b955 100644 --- a/tests/ui/const-generics/late-bound-vars/simple.rs +++ b/tests/ui/const-generics/late-bound-vars/simple.rs @@ -1,4 +1,21 @@ -// run-pass +// failure-status: 101 +// known-bug: unknown +// error-pattern:internal compiler error +// normalize-stderr-test "internal compiler error.*" -> "" +// normalize-stderr-test "DefId\([^)]*\)" -> "..." +// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> "" +// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> "" +// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> "" +// normalize-stderr-test "note: compiler flags.*\n\n" -> "" +// normalize-stderr-test "note: rustc.*running on.*\n\n" -> "" +// normalize-stderr-test "thread.*panicked.*\n" -> "" +// normalize-stderr-test "stack backtrace:\n" -> "" +// normalize-stderr-test "\s\d{1,}: .*\n" -> "" +// normalize-stderr-test "\s at .*\n" -> "" +// normalize-stderr-test ".*note: Some details.*\n" -> "" +// normalize-stderr-test "\n\n[ ]*\n" -> "" +// normalize-stderr-test "compiler/.*: projection" -> "projection" + #![feature(generic_const_exprs)] #![allow(incomplete_features)] diff --git a/tests/ui/const-generics/late-bound-vars/simple.stderr b/tests/ui/const-generics/late-bound-vars/simple.stderr new file mode 100644 index 000000000000..c0568f5a5cfa --- /dev/null +++ b/tests/ui/const-generics/late-bound-vars/simple.stderr @@ -0,0 +1,13 @@ +error: query stack during panic: +#0 [mir_borrowck] borrow-checking `test::{constant#1}` +#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `test::{constant#1}` +#2 [mir_for_ctfe] caching mir of `test::{constant#1}` for CTFE +#3 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}` +#4 [eval_to_allocation_raw] const-evaluating + checking `test::{constant#1}` +#5 [eval_to_valtree] evaluating type-level constant +#6 [typeck] type-checking `test` +#7 [used_trait_imports] finding used_trait_imports `test` +#8 [analysis] running analysis passes on this crate +end of query stack +error: aborting due to previous error + diff --git a/tests/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.rs b/tests/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.rs index 6215b7d936cf..86f2bc9c74b9 100644 --- a/tests/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.rs +++ b/tests/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.rs @@ -5,7 +5,7 @@ fn test() {} fn issue_75323_and_74447_1<'a>() -> &'a () { test::<{ let _: &'a (); 3 },>(); - //~^ ERROR a non-static lifetime is not allowed in a `const` + //~^ ERROR generic parameters may not be used in const operations &() } @@ -19,7 +19,7 @@ fn issue_75323_and_74447_3() { fn issue_73375<'a>() { [(); (|_: &'a u8| (), 0).1]; - //~^ ERROR a non-static lifetime is not allowed in a `const` + //~^ ERROR generic parameters may not be used in const operations } fn main() {} diff --git a/tests/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.stderr b/tests/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.stderr index 5f641b070951..7726016eb835 100644 --- a/tests/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.stderr +++ b/tests/ui/const-generics/min_const_generics/forbid-non-static-lifetimes.stderr @@ -1,21 +1,20 @@ -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/forbid-non-static-lifetimes.rs:7:22 | LL | test::<{ let _: &'a (); 3 },>(); - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/forbid-non-static-lifetimes.rs:21:16 | LL | [(); (|_: &'a u8| (), 0).1]; - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/tests/ui/const-generics/outer-lifetime-in-const-generic-default.rs b/tests/ui/const-generics/outer-lifetime-in-const-generic-default.rs index 3018439afa71..de710b0e37d3 100644 --- a/tests/ui/const-generics/outer-lifetime-in-const-generic-default.rs +++ b/tests/ui/const-generics/outer-lifetime-in-const-generic-default.rs @@ -2,7 +2,7 @@ struct Foo< 'a, const N: usize = { let x: &'a (); - //~^ ERROR use of non-static lifetime `'a` in const generic + //~^ ERROR generic parameters may not be used in const operations 3 }, >(&'a ()); diff --git a/tests/ui/const-generics/outer-lifetime-in-const-generic-default.stderr b/tests/ui/const-generics/outer-lifetime-in-const-generic-default.stderr index 9d9555d3f647..6b0d18f1989a 100644 --- a/tests/ui/const-generics/outer-lifetime-in-const-generic-default.stderr +++ b/tests/ui/const-generics/outer-lifetime-in-const-generic-default.stderr @@ -1,11 +1,11 @@ -error[E0771]: use of non-static lifetime `'a` in const generic +error: generic parameters may not be used in const operations --> $DIR/outer-lifetime-in-const-generic-default.rs:4:17 | LL | let x: &'a (); - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: for more information, see issue #74052 + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: aborting due to previous error -For more information about this error, try `rustc --explain E0771`. diff --git a/tests/ui/const-generics/variant-discrimiant-no-generics.full.stderr b/tests/ui/const-generics/variant-discrimiant-no-generics.full.stderr new file mode 100644 index 000000000000..2f03b8e1f664 --- /dev/null +++ b/tests/ui/const-generics/variant-discrimiant-no-generics.full.stderr @@ -0,0 +1,34 @@ +error: generic parameters may not be used in enum discriminant values + --> $DIR/variant-discrimiant-no-generics.rs:7:15 + | +LL | Variant = N, + | ^ cannot perform const operation using `N` + | + = note: const parameters may not be used in enum discriminant values + +error: generic parameters may not be used in enum discriminant values + --> $DIR/variant-discrimiant-no-generics.rs:12:17 + | +LL | Variant = { N + 1 }, + | ^ cannot perform const operation using `N` + | + = note: const parameters may not be used in enum discriminant values + +error: generic parameters may not be used in enum discriminant values + --> $DIR/variant-discrimiant-no-generics.rs:18:37 + | +LL | Variant = { std::mem::size_of::() as isize }, + | ^ cannot perform const operation using `T` + | + = note: type parameters may not be used in enum discriminant values + +error: generic parameters may not be used in enum discriminant values + --> $DIR/variant-discrimiant-no-generics.rs:25:17 + | +LL | let a: &'a (); + | ^^ cannot perform const operation using `'a` + | + = note: lifetime parameters may not be used in enum discriminant values + +error: aborting due to 4 previous errors + diff --git a/tests/ui/const-generics/variant-discrimiant-no-generics.min.stderr b/tests/ui/const-generics/variant-discrimiant-no-generics.min.stderr new file mode 100644 index 000000000000..2f03b8e1f664 --- /dev/null +++ b/tests/ui/const-generics/variant-discrimiant-no-generics.min.stderr @@ -0,0 +1,34 @@ +error: generic parameters may not be used in enum discriminant values + --> $DIR/variant-discrimiant-no-generics.rs:7:15 + | +LL | Variant = N, + | ^ cannot perform const operation using `N` + | + = note: const parameters may not be used in enum discriminant values + +error: generic parameters may not be used in enum discriminant values + --> $DIR/variant-discrimiant-no-generics.rs:12:17 + | +LL | Variant = { N + 1 }, + | ^ cannot perform const operation using `N` + | + = note: const parameters may not be used in enum discriminant values + +error: generic parameters may not be used in enum discriminant values + --> $DIR/variant-discrimiant-no-generics.rs:18:37 + | +LL | Variant = { std::mem::size_of::() as isize }, + | ^ cannot perform const operation using `T` + | + = note: type parameters may not be used in enum discriminant values + +error: generic parameters may not be used in enum discriminant values + --> $DIR/variant-discrimiant-no-generics.rs:25:17 + | +LL | let a: &'a (); + | ^^ cannot perform const operation using `'a` + | + = note: lifetime parameters may not be used in enum discriminant values + +error: aborting due to 4 previous errors + diff --git a/tests/ui/const-generics/variant-discrimiant-no-generics.rs b/tests/ui/const-generics/variant-discrimiant-no-generics.rs new file mode 100644 index 000000000000..e286aa9a6139 --- /dev/null +++ b/tests/ui/const-generics/variant-discrimiant-no-generics.rs @@ -0,0 +1,32 @@ +// revisions: full min + +#![cfg_attr(full, feature(generic_const_exprs))] +#![cfg_attr(full, allow(incomplete_features))] + +enum Foo { + Variant = N, + //~^ ERROR: generic parameters may not be used in enum discriminant values +} + +enum Owo { + Variant = { N + 1 }, + //~^ ERROR: generic parameters may not be used in enum discriminant values +} + +#[repr(isize)] +enum Bar { + Variant = { std::mem::size_of::() as isize }, + Other(T), //~^ ERROR: generic parameters may not be used in enum discriminant values +} + +#[repr(isize)] +enum UwU<'a> { + Variant = { + let a: &'a (); + //~^ ERROR: generic parameters may not be used in enum discriminant values + 10_isize + }, + Other(&'a ()), +} + +fn main() {} diff --git a/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs b/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs index ad9fcc25b412..62137c0c8d34 100644 --- a/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs +++ b/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.rs @@ -7,7 +7,7 @@ use core::intrinsics::discriminant_value; enum MyWeirdOption { None = 0, Some(T) = std::mem::size_of::(), - //~^ ERROR generic parameters may not be used in const operations + //~^ ERROR generic parameters may not be used in enum discriminant values } fn main() { diff --git a/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.stderr b/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.stderr index e4e10468d534..2cb159ee2910 100644 --- a/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.stderr +++ b/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice-2.stderr @@ -1,11 +1,10 @@ -error: generic parameters may not be used in const operations +error: generic parameters may not be used in enum discriminant values --> $DIR/issue-70453-generics-in-discr-ice-2.rs:9:35 | LL | Some(T) = std::mem::size_of::(), | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in const expressions - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + = note: type parameters may not be used in enum discriminant values error: aborting due to previous error diff --git a/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice.rs b/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice.rs index a0fb788a5109..093c57534a4c 100644 --- a/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice.rs +++ b/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice.rs @@ -8,7 +8,7 @@ enum MyWeirdOption { //~^ ERROR parameter `T` is never used None = 0, Some = std::mem::size_of::(), - //~^ ERROR generic parameters may not be used in const operations + //~^ ERROR generic parameters may not be used in enum discriminant values } fn main() { diff --git a/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice.stderr b/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice.stderr index 7ea8a39129ea..fac3ce07aeb9 100644 --- a/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice.stderr +++ b/tests/ui/enum-discriminant/issue-70453-generics-in-discr-ice.stderr @@ -1,11 +1,10 @@ -error: generic parameters may not be used in const operations +error: generic parameters may not be used in enum discriminant values --> $DIR/issue-70453-generics-in-discr-ice.rs:10:32 | LL | Some = std::mem::size_of::(), | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in const expressions - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + = note: type parameters may not be used in enum discriminant values error[E0392]: parameter `T` is never used --> $DIR/issue-70453-generics-in-discr-ice.rs:7:20 diff --git a/tests/ui/enum-discriminant/issue-70453-polymorphic-ctfe.stderr b/tests/ui/enum-discriminant/issue-70453-polymorphic-ctfe.stderr index 0a7a631606ee..15cd6d30364b 100644 --- a/tests/ui/enum-discriminant/issue-70453-polymorphic-ctfe.stderr +++ b/tests/ui/enum-discriminant/issue-70453-polymorphic-ctfe.stderr @@ -1,11 +1,10 @@ -error: generic parameters may not be used in const operations +error: generic parameters may not be used in enum discriminant values --> $DIR/issue-70453-polymorphic-ctfe.rs:9:41 | LL | Some(T) = core::mem::size_of::<*mut T>(), | ^ cannot perform const operation using `T` | - = note: type parameters may not be used in const expressions - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + = note: type parameters may not be used in enum discriminant values error: aborting due to previous error diff --git a/tests/ui/enum/issue-67945-1.stderr b/tests/ui/enum/issue-67945-1.stderr index 8f1b5b38e4c3..878fa322f02d 100644 --- a/tests/ui/enum/issue-67945-1.stderr +++ b/tests/ui/enum/issue-67945-1.stderr @@ -1,11 +1,10 @@ -error: generic parameters may not be used in const operations +error: generic parameters may not be used in enum discriminant values --> $DIR/issue-67945-1.rs:3:16 | LL | let x: S = 0; | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in const expressions - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + = note: type parameters may not be used in enum discriminant values error[E0392]: parameter `S` is never used --> $DIR/issue-67945-1.rs:1:10 diff --git a/tests/ui/enum/issue-67945-2.stderr b/tests/ui/enum/issue-67945-2.stderr index 63d3521afe4f..f8ec12d470ac 100644 --- a/tests/ui/enum/issue-67945-2.stderr +++ b/tests/ui/enum/issue-67945-2.stderr @@ -1,11 +1,10 @@ -error: generic parameters may not be used in const operations +error: generic parameters may not be used in enum discriminant values --> $DIR/issue-67945-2.rs:4:28 | LL | Var = type_ascribe!(0, S), | ^ cannot perform const operation using `S` | - = note: type parameters may not be used in const expressions - = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions + = note: type parameters may not be used in enum discriminant values error[E0392]: parameter `S` is never used --> $DIR/issue-67945-2.rs:3:10 diff --git a/tests/ui/error-codes/E0771.rs b/tests/ui/error-codes/E0771.rs index 67e7d106a1fc..c0a2e98a7df6 100644 --- a/tests/ui/error-codes/E0771.rs +++ b/tests/ui/error-codes/E0771.rs @@ -1,7 +1,7 @@ #![feature(adt_const_params)] //~^ WARN the feature `adt_const_params` is incomplete -fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0771 +fn function_with_str<'a, const STRING: &'a str>() {} //~ ERROR E0770 fn main() { function_with_str::<"Hello, world!">() diff --git a/tests/ui/error-codes/E0771.stderr b/tests/ui/error-codes/E0771.stderr index b759399a940b..9450c61c27be 100644 --- a/tests/ui/error-codes/E0771.stderr +++ b/tests/ui/error-codes/E0771.stderr @@ -1,10 +1,10 @@ -error[E0771]: use of non-static lifetime `'a` in const generic +error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/E0771.rs:4:41 | LL | fn function_with_str<'a, const STRING: &'a str>() {} - | ^^ + | ^^ the type must not depend on the parameter `'a` | - = note: for more information, see issue #74052 + = note: lifetime parameters may not be used in the type of const parameters warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes --> $DIR/E0771.rs:1:12 @@ -17,4 +17,4 @@ LL | #![feature(adt_const_params)] error: aborting due to previous error; 1 warning emitted -For more information about this error, try `rustc --explain E0771`. +For more information about this error, try `rustc --explain E0770`. diff --git a/tests/ui/lifetimes/issue-64173-unused-lifetimes.rs b/tests/ui/lifetimes/issue-64173-unused-lifetimes.rs index 8080dd7dc34d..3879784d0b0f 100644 --- a/tests/ui/lifetimes/issue-64173-unused-lifetimes.rs +++ b/tests/ui/lifetimes/issue-64173-unused-lifetimes.rs @@ -13,7 +13,7 @@ const fn foo() -> usize { } struct Bar<'a> { //~ ERROR: parameter `'a` is never used - beta: [(); foo::<&'a ()>()], //~ ERROR: a non-static lifetime is not allowed in a `const` + beta: [(); foo::<&'a ()>()], //~ ERROR: generic parameters may not be used in const operations } fn main() {} diff --git a/tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr b/tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr index a487cbea5371..02ca10b2eb67 100644 --- a/tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr +++ b/tests/ui/lifetimes/issue-64173-unused-lifetimes.stderr @@ -1,11 +1,11 @@ -error[E0658]: a non-static lifetime is not allowed in a `const` +error: generic parameters may not be used in const operations --> $DIR/issue-64173-unused-lifetimes.rs:16:23 | LL | beta: [(); foo::<&'a ()>()], - | ^^ + | ^^ cannot perform const operation using `'a` | - = note: see issue #76560 for more information - = help: add `#![feature(generic_const_exprs)]` to the crate attributes to enable + = note: lifetime parameters may not be used in const expressions + = help: use `#![feature(generic_const_exprs)]` to allow generic const expressions error: generic `Self` types are currently not permitted in anonymous constants --> $DIR/issue-64173-unused-lifetimes.rs:4:28 @@ -31,5 +31,4 @@ LL | struct Bar<'a> { error: aborting due to 4 previous errors -Some errors have detailed explanations: E0392, E0658. -For more information about an error, try `rustc --explain E0392`. +For more information about this error, try `rustc --explain E0392`. diff --git a/tests/ui/lifetimes/unusual-rib-combinations.rs b/tests/ui/lifetimes/unusual-rib-combinations.rs index 0ae68ad04f75..2f5ba98445bd 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.rs +++ b/tests/ui/lifetimes/unusual-rib-combinations.rs @@ -27,7 +27,7 @@ fn d() {} trait Foo<'a> {} struct Bar Foo<'a>)>; -//~^ ERROR use of non-static lifetime `'a` in const generic +//~^ ERROR the type of const parameters must not depend on other generic parameters //~| ERROR `&dyn for<'a> Foo<'a>` is forbidden as the type of a const generic parameter fn main() {} diff --git a/tests/ui/lifetimes/unusual-rib-combinations.stderr b/tests/ui/lifetimes/unusual-rib-combinations.stderr index 20163d289b13..4994e4dc444e 100644 --- a/tests/ui/lifetimes/unusual-rib-combinations.stderr +++ b/tests/ui/lifetimes/unusual-rib-combinations.stderr @@ -9,13 +9,13 @@ help: consider introducing a named lifetime parameter LL | fn d<'a, const C: S<'a>>() {} | +++ ++++ -error[E0771]: use of non-static lifetime `'a` in const generic +error[E0770]: the type of const parameters must not depend on other generic parameters --> $DIR/unusual-rib-combinations.rs:29:22 | LL | struct Bar Foo<'a>)>; - | ^^ + | ^^ the type must not depend on the parameter `'a` | - = note: for more information, see issue #74052 + = note: lifetime parameters may not be used in the type of const parameters error[E0214]: parenthesized type parameters may only be used with a `Fn` trait --> $DIR/unusual-rib-combinations.rs:7:16 @@ -74,5 +74,5 @@ LL | struct Bar Foo<'a>)>; error: aborting due to 9 previous errors -Some errors have detailed explanations: E0106, E0214, E0308, E0771. +Some errors have detailed explanations: E0106, E0214, E0308, E0770. For more information about an error, try `rustc --explain E0106`. From f46eabb9e56fab132ec8171d0e0239f42c986e52 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Fri, 5 May 2023 15:52:53 +0100 Subject: [PATCH 40/97] Report nicer lifetime errors for specialization Add an obligation cause for these error so that the error points to the implementations that caused the error. --- .../src/impl_wf_check/min_specialization.rs | 19 +++++-- .../src/traits/coherence.rs | 4 +- .../rustc_trait_selection/src/traits/mod.rs | 4 +- .../src/traits/specialize/mod.rs | 34 +++++++++++-- .../rustc_trait_selection/src/traits/util.rs | 4 +- .../specialize_with_generalize_lifetimes.rs | 50 +++++++++++++++++++ ...pecialize_with_generalize_lifetimes.stderr | 27 ++++++++++ 7 files changed, 132 insertions(+), 10 deletions(-) create mode 100644 tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.rs create mode 100644 tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.stderr diff --git a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs index 4f0df5c5677b..e84da2519ae8 100644 --- a/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs +++ b/compiler/rustc_hir_analysis/src/impl_wf_check/min_specialization.rs @@ -80,7 +80,7 @@ use rustc_middle::ty::{self, TyCtxt, TypeVisitableExt}; use rustc_span::Span; use rustc_trait_selection::traits::error_reporting::TypeErrCtxtExt; use rustc_trait_selection::traits::outlives_bounds::InferCtxtExt as _; -use rustc_trait_selection::traits::{self, translate_substs, wf, ObligationCtxt}; +use rustc_trait_selection::traits::{self, translate_substs_with_cause, wf, ObligationCtxt}; pub(super) fn check_min_specialization(tcx: TyCtxt<'_>, impl_def_id: LocalDefId) { if let Some(node) = parent_specialization_node(tcx, impl_def_id) { @@ -180,8 +180,21 @@ fn get_impl_substs( ocx.assumed_wf_types(param_env, tcx.def_span(impl1_def_id), impl1_def_id); let impl1_substs = InternalSubsts::identity_for_item(tcx, impl1_def_id); - let impl2_substs = - translate_substs(infcx, param_env, impl1_def_id.to_def_id(), impl1_substs, impl2_node); + let impl1_span = tcx.def_span(impl1_def_id); + let impl2_substs = translate_substs_with_cause( + infcx, + param_env, + impl1_def_id.to_def_id(), + impl1_substs, + impl2_node, + |_, span| { + traits::ObligationCause::new( + impl1_span, + impl1_def_id, + traits::ObligationCauseCode::BindingObligation(impl2_node.def_id(), span), + ) + }, + ); let errors = ocx.select_all_or_error(); if !errors.is_empty() { diff --git a/compiler/rustc_trait_selection/src/traits/coherence.rs b/compiler/rustc_trait_selection/src/traits/coherence.rs index b7690f79933d..9f405aaf1a82 100644 --- a/compiler/rustc_trait_selection/src/traits/coherence.rs +++ b/compiler/rustc_trait_selection/src/traits/coherence.rs @@ -322,7 +322,9 @@ fn negative_impl(tcx: TyCtxt<'_>, impl1_def_id: DefId, impl2_def_id: DefId) -> b let selcx = &mut SelectionContext::new(&infcx); let impl2_substs = infcx.fresh_substs_for_item(DUMMY_SP, impl2_def_id); let (subject2, obligations) = - impl_subject_and_oblig(selcx, impl_env, impl2_def_id, impl2_substs); + impl_subject_and_oblig(selcx, impl_env, impl2_def_id, impl2_substs, |_, _| { + ObligationCause::dummy() + }); !equate(&infcx, impl_env, subject1, subject2, obligations, impl1_def_id) } diff --git a/compiler/rustc_trait_selection/src/traits/mod.rs b/compiler/rustc_trait_selection/src/traits/mod.rs index 8b8c50f6b836..138b0fb74322 100644 --- a/compiler/rustc_trait_selection/src/traits/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/mod.rs @@ -54,7 +54,9 @@ pub use self::select::{EvaluationCache, SelectionCache, SelectionContext}; pub use self::select::{EvaluationResult, IntercrateAmbiguityCause, OverflowError}; pub use self::specialize::specialization_graph::FutureCompatOverlapError; pub use self::specialize::specialization_graph::FutureCompatOverlapErrorKind; -pub use self::specialize::{specialization_graph, translate_substs, OverlapError}; +pub use self::specialize::{ + specialization_graph, translate_substs, translate_substs_with_cause, OverlapError, +}; pub use self::structural_match::{ search_for_adt_const_param_violation, search_for_structural_match_violation, }; diff --git a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs index 8bbebadb22aa..9a4b72013b88 100644 --- a/compiler/rustc_trait_selection/src/traits/specialize/mod.rs +++ b/compiler/rustc_trait_selection/src/traits/specialize/mod.rs @@ -82,6 +82,30 @@ pub fn translate_substs<'tcx>( source_impl: DefId, source_substs: SubstsRef<'tcx>, target_node: specialization_graph::Node, +) -> SubstsRef<'tcx> { + translate_substs_with_cause( + infcx, + param_env, + source_impl, + source_substs, + target_node, + |_, _| ObligationCause::dummy(), + ) +} + +/// Like [translate_substs], but obligations from the parent implementation +/// are registered with the provided `ObligationCause`. +/// +/// This is for reporting *region* errors from those bounds. Type errors should +/// not happen because the specialization graph already checks for those, and +/// will result in an ICE. +pub fn translate_substs_with_cause<'tcx>( + infcx: &InferCtxt<'tcx>, + param_env: ty::ParamEnv<'tcx>, + source_impl: DefId, + source_substs: SubstsRef<'tcx>, + target_node: specialization_graph::Node, + cause: impl Fn(usize, Span) -> ObligationCause<'tcx>, ) -> SubstsRef<'tcx> { debug!( "translate_substs({:?}, {:?}, {:?}, {:?})", @@ -99,7 +123,7 @@ pub fn translate_substs<'tcx>( return source_substs; } - fulfill_implication(infcx, param_env, source_trait_ref, source_impl, target_impl) + fulfill_implication(infcx, param_env, source_trait_ref, source_impl, target_impl, cause) .unwrap_or_else(|()| { bug!( "When translating substitutions from {source_impl:?} to {target_impl:?}, \ @@ -154,7 +178,10 @@ pub(super) fn specializes(tcx: TyCtxt<'_>, (impl1_def_id, impl2_def_id): (DefId, let infcx = tcx.infer_ctxt().build(); // Attempt to prove that impl2 applies, given all of the above. - fulfill_implication(&infcx, penv, impl1_trait_ref, impl1_def_id, impl2_def_id).is_ok() + fulfill_implication(&infcx, penv, impl1_trait_ref, impl1_def_id, impl2_def_id, |_, _| { + ObligationCause::dummy() + }) + .is_ok() } /// Attempt to fulfill all obligations of `target_impl` after unification with @@ -168,6 +195,7 @@ fn fulfill_implication<'tcx>( source_trait_ref: ty::TraitRef<'tcx>, source_impl: DefId, target_impl: DefId, + error_cause: impl Fn(usize, Span) -> ObligationCause<'tcx>, ) -> Result, ()> { debug!( "fulfill_implication({:?}, trait_ref={:?} |- {:?} applies)", @@ -195,7 +223,7 @@ fn fulfill_implication<'tcx>( let selcx = &mut SelectionContext::new(&infcx); let target_substs = infcx.fresh_substs_for_item(DUMMY_SP, target_impl); let (target_trait, obligations) = - util::impl_subject_and_oblig(selcx, param_env, target_impl, target_substs); + util::impl_subject_and_oblig(selcx, param_env, target_impl, target_substs, error_cause); // do the impls unify? If not, no specialization. let Ok(InferOk { obligations: more_obligations, .. }) = diff --git a/compiler/rustc_trait_selection/src/traits/util.rs b/compiler/rustc_trait_selection/src/traits/util.rs index 7b7e297c64b1..82f3df401988 100644 --- a/compiler/rustc_trait_selection/src/traits/util.rs +++ b/compiler/rustc_trait_selection/src/traits/util.rs @@ -197,6 +197,7 @@ pub fn impl_subject_and_oblig<'a, 'tcx>( param_env: ty::ParamEnv<'tcx>, impl_def_id: DefId, impl_substs: SubstsRef<'tcx>, + cause: impl Fn(usize, Span) -> ObligationCause<'tcx>, ) -> (ImplSubject<'tcx>, impl Iterator>) { let subject = selcx.tcx().impl_subject(impl_def_id); let subject = subject.subst(selcx.tcx(), impl_substs); @@ -208,8 +209,7 @@ pub fn impl_subject_and_oblig<'a, 'tcx>( let predicates = predicates.instantiate(selcx.tcx(), impl_substs); let InferOk { value: predicates, obligations: normalization_obligations2 } = selcx.infcx.at(&ObligationCause::dummy(), param_env).normalize(predicates); - let impl_obligations = - super::predicates_for_generics(|_, _| ObligationCause::dummy(), param_env, predicates); + let impl_obligations = super::predicates_for_generics(cause, param_env, predicates); let impl_obligations = impl_obligations .chain(normalization_obligations1.into_iter()) diff --git a/tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.rs b/tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.rs new file mode 100644 index 000000000000..d90b81f717a6 --- /dev/null +++ b/tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.rs @@ -0,0 +1,50 @@ +// Regression test for #79457. + +#![feature(min_specialization)] + +use std::any::Any; + +pub trait Tr { + fn method(self) -> Box; + fn other(self); +} + +impl Tr for T { + default fn method(self) -> Box { + Box::new(self) + } + + default fn other(self) {} +} + +impl<'a> Tr for &'a i32 { + //~^ ERROR does not fulfill the required lifetime + fn other(self) {} +} + +fn promote_to_static<'a>(i: &'a i32) -> &'static i32 { + *i.method().downcast().unwrap() +} + +struct Wrapper<'a>(&'a i32); + +impl<'a> Tr for Wrapper<'a> { + //~^ ERROR does not fulfill the required lifetime + fn other(self) {} +} + +fn promote_to_static_2<'a>(w: Wrapper<'a>) -> Wrapper<'static> { + *w.method().downcast().unwrap() +} + +fn main() { + let i = Box::new(100_i32); + let static_i: &'static i32 = promote_to_static(&*i); + drop(i); + println!("{}", *static_i); + + let j = Box::new(200_i32); + let static_w: Wrapper<'static> = promote_to_static_2(Wrapper(&*j)); + drop(j); + println!("{}", *static_w.0); +} diff --git a/tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.stderr b/tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.stderr new file mode 100644 index 000000000000..2af75876d5b0 --- /dev/null +++ b/tests/ui/specialization/min_specialization/specialize_with_generalize_lifetimes.stderr @@ -0,0 +1,27 @@ +error[E0477]: the type `&'a i32` does not fulfill the required lifetime + --> $DIR/specialize_with_generalize_lifetimes.rs:20:1 + | +LL | impl<'a> Tr for &'a i32 { + | ^^^^^^^^^^^^^^^^^^^^^^^ + | +note: type must satisfy the static lifetime as required by this binding + --> $DIR/specialize_with_generalize_lifetimes.rs:12:15 + | +LL | impl Tr for T { + | ^^^^^^^ + +error[E0477]: the type `Wrapper<'a>` does not fulfill the required lifetime + --> $DIR/specialize_with_generalize_lifetimes.rs:31:1 + | +LL | impl<'a> Tr for Wrapper<'a> { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: type must satisfy the static lifetime as required by this binding + --> $DIR/specialize_with_generalize_lifetimes.rs:12:15 + | +LL | impl Tr for T { + | ^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0477`. From b5ee324d79b310761b98173825895b16b859361b Mon Sep 17 00:00:00 2001 From: Markus Everling Date: Sat, 6 May 2023 17:31:51 +0000 Subject: [PATCH 41/97] Always const-eval the gcd in `slice::align_to_offsets` --- library/core/src/slice/mod.rs | 43 +++++------------------------------ 1 file changed, 6 insertions(+), 37 deletions(-) diff --git a/library/core/src/slice/mod.rs b/library/core/src/slice/mod.rs index d4981af90d19..28a6c05c3836 100644 --- a/library/core/src/slice/mod.rs +++ b/library/core/src/slice/mod.rs @@ -3474,44 +3474,13 @@ impl [T] { // Ts = size_of:: / gcd(size_of::, size_of::) // // Luckily since all this is constant-evaluated... performance here matters not! - #[inline] - fn gcd(a: usize, b: usize) -> usize { - use crate::intrinsics; - // iterative stein’s algorithm - // We should still make this `const fn` (and revert to recursive algorithm if we do) - // because relying on llvm to consteval all this is… well, it makes me uncomfortable. - - // SAFETY: `a` and `b` are checked to be non-zero values. - let (ctz_a, mut ctz_b) = unsafe { - if a == 0 { - return b; - } - if b == 0 { - return a; - } - (intrinsics::cttz_nonzero(a), intrinsics::cttz_nonzero(b)) - }; - let k = ctz_a.min(ctz_b); - let mut a = a >> ctz_a; - let mut b = b; - loop { - // remove all factors of 2 from b - b >>= ctz_b; - if a > b { - mem::swap(&mut a, &mut b); - } - b = b - a; - // SAFETY: `b` is checked to be non-zero. - unsafe { - if b == 0 { - break; - } - ctz_b = intrinsics::cttz_nonzero(b); - } - } - a << k + const fn gcd(a: usize, b: usize) -> usize { + if b == 0 { a } else { gcd(b, a % b) } } - let gcd: usize = gcd(mem::size_of::(), mem::size_of::()); + + // Explicitly wrap the function call in a const block so it gets + // constant-evaluated even in debug mode. + let gcd: usize = const { gcd(mem::size_of::(), mem::size_of::()) }; let ts: usize = mem::size_of::() / gcd; let us: usize = mem::size_of::() / gcd; From 4e7c14fe9f03dd0189f954bd9cb97c3c513e7eed Mon Sep 17 00:00:00 2001 From: ozkanonur Date: Sun, 7 May 2023 00:12:29 +0300 Subject: [PATCH 42/97] enable `rust_2018_idioms` for doctests Signed-off-by: ozkanonur --- compiler/rustc_ast_lowering/src/lib.rs | 6 ++- .../src/deriving/generic/mod.rs | 2 +- compiler/rustc_graphviz/src/lib.rs | 10 ++-- .../src/check/compare_impl_item.rs | 46 ++++++++++++------- .../src/collect/resolve_bound_vars.rs | 2 +- .../infer/error_reporting/need_type_info.rs | 2 +- .../nice_region_error/different_lifetimes.rs | 2 +- .../nice_region_error/find_anon_type.rs | 2 +- .../src/infer/outlives/test_type_match.rs | 8 ++-- .../rustc_infer/src/infer/outlives/verify.rs | 2 +- .../src/infer/region_constraints/mod.rs | 4 +- compiler/rustc_lint_defs/src/builtin.rs | 3 ++ library/alloc/src/borrow.rs | 8 ++-- library/alloc/src/fmt.rs | 8 ++-- library/alloc/src/rc.rs | 2 +- library/alloc/src/string.rs | 2 +- library/alloc/src/sync.rs | 2 +- library/alloc/src/vec/drain.rs | 2 +- library/alloc/src/vec/drain_filter.rs | 2 +- library/alloc/src/vec/mod.rs | 4 +- library/alloc/src/vec/splice.rs | 2 +- library/core/src/cell.rs | 18 ++++---- library/core/src/fmt/builders.rs | 10 ++-- library/core/src/fmt/mod.rs | 46 +++++++++---------- library/core/src/intrinsics/mir.rs | 3 -- library/core/src/iter/adapters/chain.rs | 2 +- library/core/src/macros/mod.rs | 1 - library/core/src/marker.rs | 4 +- library/core/src/ops/arith.rs | 2 +- library/core/src/primitive_docs.rs | 1 + library/std/src/keyword_docs.rs | 2 +- library/std/src/os/unix/fs.rs | 2 +- library/std/src/path.rs | 2 +- library/std/src/primitive_docs.rs | 1 + library/std/src/process.rs | 2 +- src/bootstrap/builder.rs | 4 ++ src/bootstrap/compile.rs | 5 ++ 37 files changed, 125 insertions(+), 101 deletions(-) diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index d07355a41540..8a511d8b5fbf 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -1474,6 +1474,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { /// Given a function definition like: /// /// ```rust + /// use std::fmt::Debug; + /// /// fn test<'a, T: Debug>(x: &'a T) -> impl Debug + 'a { /// x /// } @@ -1481,13 +1483,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { /// /// we will create a TAIT definition in the HIR like /// - /// ``` + /// ```rust,ignore (pseudo-Rust) /// type TestReturn<'a, T, 'x> = impl Debug + 'x /// ``` /// /// and return a type like `TestReturn<'static, T, 'a>`, so that the function looks like: /// - /// ```rust + /// ```rust,ignore (pseudo-Rust) /// fn test<'a, T: Debug>(x: &'a T) -> TestReturn<'static, T, 'a> /// ``` /// diff --git a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs index e5a003315884..caced3d64472 100644 --- a/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs +++ b/compiler/rustc_builtin_macros/src/deriving/generic/mod.rs @@ -1038,7 +1038,7 @@ impl<'a> MethodDef<'a> { /// `&self.x` because that might cause an unaligned ref. So for any trait /// method that takes a reference, we use a local block to force a copy. /// This requires that the field impl `Copy`. - /// ``` + /// ```rust,ignore (example) /// # struct A { x: u8, y: u8 } /// impl PartialEq for A { /// fn eq(&self, other: &A) -> bool { diff --git a/compiler/rustc_graphviz/src/lib.rs b/compiler/rustc_graphviz/src/lib.rs index b70a55e89533..5d86d8958175 100644 --- a/compiler/rustc_graphviz/src/lib.rs +++ b/compiler/rustc_graphviz/src/lib.rs @@ -167,7 +167,7 @@ //! fn node_label(&self, n: &Nd) -> dot::LabelText<'_> { //! dot::LabelText::LabelStr(self.nodes[*n].into()) //! } -//! fn edge_label<'b>(&'b self, _: &Ed) -> dot::LabelText<'b> { +//! fn edge_label(&self, _: &Ed<'_>) -> dot::LabelText<'_> { //! dot::LabelText::LabelStr("⊆".into()) //! } //! } @@ -177,8 +177,8 @@ //! type Edge = Ed<'a>; //! fn nodes(&self) -> dot::Nodes<'a,Nd> { (0..self.nodes.len()).collect() } //! fn edges(&'a self) -> dot::Edges<'a,Ed<'a>> { self.edges.iter().collect() } -//! fn source(&self, e: &Ed) -> Nd { let & &(s,_) = e; s } -//! fn target(&self, e: &Ed) -> Nd { let & &(_,t) = e; t } +//! fn source(&self, e: &Ed<'_>) -> Nd { let & &(s,_) = e; s } +//! fn target(&self, e: &Ed<'_>) -> Nd { let & &(_,t) = e; t } //! } //! //! # pub fn main() { render_to(&mut Vec::new()) } @@ -226,11 +226,11 @@ //! fn node_id(&'a self, n: &Nd<'a>) -> dot::Id<'a> { //! dot::Id::new(format!("N{}", n.0)).unwrap() //! } -//! fn node_label<'b>(&'b self, n: &Nd<'b>) -> dot::LabelText<'b> { +//! fn node_label(&self, n: &Nd<'_>) -> dot::LabelText<'_> { //! let &(i, _) = n; //! dot::LabelText::LabelStr(self.nodes[i].into()) //! } -//! fn edge_label<'b>(&'b self, _: &Ed<'b>) -> dot::LabelText<'b> { +//! fn edge_label(&self, _: &Ed<'_>) -> dot::LabelText<'_> { //! dot::LabelText::LabelStr("⊆".into()) //! } //! } 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 48214b899a4b..b956ed50073e 100644 --- a/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs +++ b/compiler/rustc_hir_analysis/src/check/compare_impl_item.rs @@ -60,19 +60,21 @@ pub(super) fn compare_impl_method<'tcx>( }; } -/// This function is best explained by example. Consider a trait: +/// This function is best explained by example. Consider a trait with it's implementation: /// -/// trait Trait<'t, T> { -/// // `trait_m` -/// fn method<'a, M>(t: &'t T, m: &'a M) -> Self; -/// } +/// ```rust +/// trait Trait<'t, T> { +/// // `trait_m` +/// fn method<'a, M>(t: &'t T, m: &'a M) -> Self; +/// } /// -/// And an impl: +/// struct Foo; /// -/// impl<'i, 'j, U> Trait<'j, &'i U> for Foo { -/// // `impl_m` -/// fn method<'b, N>(t: &'j &'i U, m: &'b N) -> Foo; -/// } +/// impl<'i, 'j, U> Trait<'j, &'i U> for Foo { +/// // `impl_m` +/// fn method<'b, N>(t: &'j &'i U, m: &'b N) -> Foo { Foo } +/// } +/// ``` /// /// We wish to decide if those two method types are compatible. /// For this we have to show that, assuming the bounds of the impl hold, the @@ -82,7 +84,9 @@ pub(super) fn compare_impl_method<'tcx>( /// type parameters to impl type parameters. This is taken from the /// impl trait reference: /// -/// trait_to_impl_substs = {'t => 'j, T => &'i U, Self => Foo} +/// ```rust,ignore (pseudo-Rust) +/// trait_to_impl_substs = {'t => 'j, T => &'i U, Self => Foo} +/// ``` /// /// We create a mapping `dummy_substs` that maps from the impl type /// parameters to fresh types and regions. For type parameters, @@ -91,13 +95,17 @@ pub(super) fn compare_impl_method<'tcx>( /// regions (Note: but only early-bound regions, i.e., those /// declared on the impl or used in type parameter bounds). /// -/// impl_to_placeholder_substs = {'i => 'i0, U => U0, N => N0 } +/// ```rust,ignore (pseudo-Rust) +/// impl_to_placeholder_substs = {'i => 'i0, U => U0, N => N0 } +/// ``` /// /// Now we can apply `placeholder_substs` to the type of the impl method /// to yield a new function type in terms of our fresh, placeholder /// types: /// -/// <'b> fn(t: &'i0 U0, m: &'b) -> Foo +/// ```rust,ignore (pseudo-Rust) +/// <'b> fn(t: &'i0 U0, m: &'b) -> Foo +/// ``` /// /// We now want to extract and substitute the type of the *trait* /// method and compare it. To do so, we must create a compound @@ -106,11 +114,15 @@ pub(super) fn compare_impl_method<'tcx>( /// type parameters. We extend the mapping to also include /// the method parameters. /// -/// trait_to_placeholder_substs = { T => &'i0 U0, Self => Foo, M => N0 } +/// ```rust,ignore (pseudo-Rust) +/// trait_to_placeholder_substs = { T => &'i0 U0, Self => Foo, M => N0 } +/// ``` /// /// Applying this to the trait method type yields: /// -/// <'a> fn(t: &'i0 U0, m: &'a) -> Foo +/// ```rust,ignore (pseudo-Rust) +/// <'a> fn(t: &'i0 U0, m: &'a) -> Foo +/// ``` /// /// This type is also the same but the name of the bound region (`'a` /// vs `'b`). However, the normal subtyping rules on fn types handle @@ -1163,7 +1175,7 @@ fn compare_self_type<'tcx>( /// as the number of generics on the respective assoc item in the trait definition. /// /// For example this code emits the errors in the following code: -/// ``` +/// ```rust,compile_fail /// trait Trait { /// fn foo(); /// type Assoc; @@ -1547,7 +1559,7 @@ fn compare_synthetic_generics<'tcx>( /// the same kind as the respective generic parameter in the trait def. /// /// For example all 4 errors in the following code are emitted here: -/// ``` +/// ```rust,ignore (pseudo-Rust) /// trait Foo { /// fn foo(); /// type bar; 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 1c496f867a06..f17caba57879 100644 --- a/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs +++ b/compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs @@ -1913,7 +1913,7 @@ fn is_late_bound_map( /// handles cycle detection as we go through the query system. /// /// This is necessary in the first place for the following case: - /// ``` + /// ```rust,ignore (pseudo-Rust) /// type Alias<'a, T> = >::Assoc; /// fn foo<'a>(_: Alias<'a, ()>) -> Alias<'a, ()> { ... } /// ``` diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs index 58e3159a4e21..5000b0139df2 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs @@ -31,7 +31,7 @@ pub enum TypeAnnotationNeeded { /// ``` E0282, /// An implementation cannot be chosen unambiguously because of lack of information. - /// ```compile_fail,E0283 + /// ```compile_fail,E0790 /// let _ = Default::default(); /// ``` E0283, diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs index da0271a345e4..1a60bab18dbd 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/different_lifetimes.rs @@ -21,7 +21,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { /// /// Consider a case where we have /// - /// ```compile_fail,E0623 + /// ```compile_fail /// fn foo(x: &mut Vec<&u8>, y: &u8) { /// x.push(y); /// } diff --git a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs index fec04af23139..0df417d09501 100644 --- a/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs +++ b/compiler/rustc_infer/src/infer/error_reporting/nice_region_error/find_anon_type.rs @@ -14,7 +14,7 @@ use rustc_middle::ty::{self, Region, TyCtxt}; /// br - the bound region corresponding to the above region which is of type `BrAnon(_)` /// /// # Example -/// ```compile_fail,E0623 +/// ```compile_fail /// fn foo(x: &mut Vec<&u8>, y: &u8) /// { x.push(y); } /// ``` diff --git a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs index 01f900f050ee..75ce0f83fd63 100644 --- a/compiler/rustc_infer/src/infer/outlives/test_type_match.rs +++ b/compiler/rustc_infer/src/infer/outlives/test_type_match.rs @@ -13,9 +13,11 @@ use crate::infer::region_constraints::VerifyIfEq; /// Given a "verify-if-eq" type test like: /// -/// exists<'a...> { -/// verify_if_eq(some_type, bound_region) -/// } +/// ```rust,ignore (pseudo-Rust) +/// exists<'a...> { +/// verify_if_eq(some_type, bound_region) +/// } +/// ``` /// /// and the type `test_ty` that the type test is being tested against, /// returns: diff --git a/compiler/rustc_infer/src/infer/outlives/verify.rs b/compiler/rustc_infer/src/infer/outlives/verify.rs index e1cb53bc71d3..4b59059010f5 100644 --- a/compiler/rustc_infer/src/infer/outlives/verify.rs +++ b/compiler/rustc_infer/src/infer/outlives/verify.rs @@ -277,7 +277,7 @@ impl<'cx, 'tcx> VerifyBoundCx<'cx, 'tcx> { /// /// It will not, however, work for higher-ranked bounds like: /// - /// ```compile_fail,E0311 + /// ```ignore(this does compile today, previously was marked as `compile_fail,E0311`) /// trait Foo<'a, 'b> /// where for<'x> >::Bar: 'x /// { diff --git a/compiler/rustc_infer/src/infer/region_constraints/mod.rs b/compiler/rustc_infer/src/infer/region_constraints/mod.rs index 6692cd1d3898..c7a307b89e41 100644 --- a/compiler/rustc_infer/src/infer/region_constraints/mod.rs +++ b/compiler/rustc_infer/src/infer/region_constraints/mod.rs @@ -217,7 +217,7 @@ pub enum VerifyBound<'tcx> { /// and supplies a bound if it ended up being relevant. It's used in situations /// like this: /// -/// ```rust +/// ```rust,ignore (pseudo-Rust) /// fn foo<'a, 'b, T: SomeTrait<'a>> /// where /// >::Item: 'b @@ -232,7 +232,7 @@ pub enum VerifyBound<'tcx> { /// In the [`VerifyBound`], this struct is enclosed in `Binder` to account /// for cases like /// -/// ```rust +/// ```rust,ignore (pseudo-Rust) /// where for<'a> ::Item: 'a /// ``` /// diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs index b223b8c137a1..814513cbd6d7 100644 --- a/compiler/rustc_lint_defs/src/builtin.rs +++ b/compiler/rustc_lint_defs/src/builtin.rs @@ -333,6 +333,7 @@ declare_lint! { /// /// ```rust,compile_fail /// #![deny(unused_extern_crates)] + /// #![deny(warnings)] /// extern crate proc_macro; /// ``` /// @@ -1667,6 +1668,7 @@ declare_lint! { /// /// ```rust,compile_fail /// #![deny(elided_lifetimes_in_paths)] + /// #![deny(warnings)] /// struct Foo<'a> { /// x: &'a u32 /// } @@ -2158,6 +2160,7 @@ declare_lint! { /// ```rust,compile_fail /// # #![allow(unused)] /// #![deny(explicit_outlives_requirements)] + /// #![deny(warnings)] /// /// struct SharedRef<'a, T> /// where diff --git a/library/alloc/src/borrow.rs b/library/alloc/src/borrow.rs index 0c8c796ae9b8..84331eba2d49 100644 --- a/library/alloc/src/borrow.rs +++ b/library/alloc/src/borrow.rs @@ -115,7 +115,7 @@ where /// ``` /// use std::borrow::Cow; /// -/// fn abs_all(input: &mut Cow<[i32]>) { +/// fn abs_all(input: &mut Cow<'_, [i32]>) { /// for i in 0..input.len() { /// let v = input[i]; /// if v < 0 { @@ -145,7 +145,7 @@ where /// ``` /// use std::borrow::Cow; /// -/// struct Items<'a, X: 'a> where [X]: ToOwned> { +/// struct Items<'a, X> where [X]: ToOwned> { /// values: Cow<'a, [X]>, /// } /// @@ -267,7 +267,7 @@ impl Cow<'_, B> { /// /// assert_eq!( /// cow, - /// Cow::Owned(String::from("FOO")) as Cow + /// Cow::Owned(String::from("FOO")) as Cow<'_, str> /// ); /// ``` #[stable(feature = "rust1", since = "1.0.0")] @@ -311,7 +311,7 @@ impl Cow<'_, B> { /// use std::borrow::Cow; /// /// let s = "Hello world!"; - /// let cow: Cow = Cow::Owned(String::from(s)); + /// let cow: Cow<'_, str> = Cow::Owned(String::from(s)); /// /// assert_eq!( /// cow.into_owned(), diff --git a/library/alloc/src/fmt.rs b/library/alloc/src/fmt.rs index e03b501ae4d2..fb8d00e8d873 100644 --- a/library/alloc/src/fmt.rs +++ b/library/alloc/src/fmt.rs @@ -363,7 +363,7 @@ //! # use std::fmt; //! # struct Foo; // our custom type //! # impl fmt::Display for Foo { -//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +//! fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { //! # write!(f, "testing, testing") //! # } } //! ``` @@ -399,7 +399,7 @@ //! } //! //! impl fmt::Display for Vector2D { -//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +//! fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { //! // The `f` value implements the `Write` trait, which is what the //! // write! macro is expecting. Note that this formatting ignores the //! // various flags provided to format strings. @@ -410,7 +410,7 @@ //! // Different traits allow different forms of output of a type. The meaning //! // of this format is to print the magnitude of a vector. //! impl fmt::Binary for Vector2D { -//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +//! fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { //! let magnitude = (self.x * self.x + self.y * self.y) as f64; //! let magnitude = magnitude.sqrt(); //! @@ -517,7 +517,7 @@ //! let mut some_writer = io::stdout(); //! write!(&mut some_writer, "{}", format_args!("print with a {}", "macro")); //! -//! fn my_fmt_fn(args: fmt::Arguments) { +//! fn my_fmt_fn(args: fmt::Arguments<'_>) { //! write!(&mut io::stdout(), "{args}"); //! } //! my_fmt_fn(format_args!(", or a {} too", "function")); diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index cf93a40496fd..ae3d026ac4ee 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -2039,7 +2039,7 @@ where /// ```rust /// # use std::rc::Rc; /// # use std::borrow::Cow; - /// let cow: Cow = Cow::Borrowed("eggplant"); + /// let cow: Cow<'_, str> = Cow::Borrowed("eggplant"); /// let shared: Rc = Rc::from(cow); /// assert_eq!("eggplant", &shared[..]); /// ``` diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index cf16a3424a09..4813422e1603 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -2732,7 +2732,7 @@ impl<'a> From> for String { /// ``` /// # use std::borrow::Cow; /// // If the string is not owned... - /// let cow: Cow = Cow::Borrowed("eggplant"); + /// let cow: Cow<'_, str> = Cow::Borrowed("eggplant"); /// // It will allocate on the heap and copy the string. /// let owned: String = String::from(cow); /// assert_eq!(&owned[..], "eggplant"); diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 5bfe537bc830..52a8545413a5 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -2768,7 +2768,7 @@ where /// ```rust /// # use std::sync::Arc; /// # use std::borrow::Cow; - /// let cow: Cow = Cow::Borrowed("eggplant"); + /// let cow: Cow<'_, str> = Cow::Borrowed("eggplant"); /// let shared: Arc = Arc::from(cow); /// assert_eq!("eggplant", &shared[..]); /// ``` diff --git a/library/alloc/src/vec/drain.rs b/library/alloc/src/vec/drain.rs index 3091efabd684..f0b63759ac70 100644 --- a/library/alloc/src/vec/drain.rs +++ b/library/alloc/src/vec/drain.rs @@ -16,7 +16,7 @@ use super::Vec; /// /// ``` /// let mut v = vec![0, 1, 2]; -/// let iter: std::vec::Drain<_> = v.drain(..); +/// let iter: std::vec::Drain<'_, _> = v.drain(..); /// ``` #[stable(feature = "drain", since = "1.6.0")] pub struct Drain< diff --git a/library/alloc/src/vec/drain_filter.rs b/library/alloc/src/vec/drain_filter.rs index 650f92138902..21b090234620 100644 --- a/library/alloc/src/vec/drain_filter.rs +++ b/library/alloc/src/vec/drain_filter.rs @@ -16,7 +16,7 @@ use super::Vec; /// #![feature(drain_filter)] /// /// let mut v = vec![0, 1, 2]; -/// let iter: std::vec::DrainFilter<_, _> = v.drain_filter(|x| *x % 2 == 0); +/// let iter: std::vec::DrainFilter<'_, _, _> = v.drain_filter(|x| *x % 2 == 0); /// ``` #[unstable(feature = "drain_filter", reason = "recently added", issue = "43244")] #[derive(Debug)] diff --git a/library/alloc/src/vec/mod.rs b/library/alloc/src/vec/mod.rs index 765c095e37bf..97da6f06b700 100644 --- a/library/alloc/src/vec/mod.rs +++ b/library/alloc/src/vec/mod.rs @@ -3142,8 +3142,8 @@ where /// /// ``` /// # use std::borrow::Cow; - /// let o: Cow<[i32]> = Cow::Owned(vec![1, 2, 3]); - /// let b: Cow<[i32]> = Cow::Borrowed(&[1, 2, 3]); + /// let o: Cow<'_, [i32]> = Cow::Owned(vec![1, 2, 3]); + /// let b: Cow<'_, [i32]> = Cow::Borrowed(&[1, 2, 3]); /// assert_eq!(Vec::from(o), Vec::from(b)); /// ``` fn from(s: Cow<'a, [T]>) -> Vec { diff --git a/library/alloc/src/vec/splice.rs b/library/alloc/src/vec/splice.rs index 1861147fe72f..852fdcc3f5ce 100644 --- a/library/alloc/src/vec/splice.rs +++ b/library/alloc/src/vec/splice.rs @@ -14,7 +14,7 @@ use super::{Drain, Vec}; /// ``` /// let mut v = vec![0, 1, 2]; /// let new = [7, 8]; -/// let iter: std::vec::Splice<_> = v.splice(1.., new); +/// let iter: std::vec::Splice<'_, _> = v.splice(1.., new); /// ``` #[derive(Debug)] #[stable(feature = "vec_splice", since = "1.21.0")] diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index bcca8d924cdd..5c5a4fd0e3f1 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -115,7 +115,7 @@ //! let shared_map: Rc> = Rc::new(RefCell::new(HashMap::new())); //! // Create a new block to limit the scope of the dynamic borrow //! { -//! let mut map: RefMut<_> = shared_map.borrow_mut(); +//! let mut map: RefMut<'_, _> = shared_map.borrow_mut(); //! map.insert("africa", 92388); //! map.insert("kyoto", 11837); //! map.insert("piccadilly", 11826); @@ -1435,8 +1435,8 @@ impl<'b, T: ?Sized> Ref<'b, T> { /// use std::cell::{RefCell, Ref}; /// /// let c = RefCell::new((5, 'b')); - /// let b1: Ref<(u32, char)> = c.borrow(); - /// let b2: Ref = Ref::map(b1, |t| &t.0); + /// let b1: Ref<'_, (u32, char)> = c.borrow(); + /// let b2: Ref<'_, u32> = Ref::map(b1, |t| &t.0); /// assert_eq!(*b2, 5) /// ``` #[stable(feature = "cell_map", since = "1.8.0")] @@ -1464,8 +1464,8 @@ impl<'b, T: ?Sized> Ref<'b, T> { /// use std::cell::{RefCell, Ref}; /// /// let c = RefCell::new(vec![1, 2, 3]); - /// let b1: Ref> = c.borrow(); - /// let b2: Result, _> = Ref::filter_map(b1, |v| v.get(1)); + /// let b1: Ref<'_, Vec> = c.borrow(); + /// let b2: Result, _> = Ref::filter_map(b1, |v| v.get(1)); /// assert_eq!(*b2.unwrap(), 2); /// ``` #[stable(feature = "cell_filter_map", since = "1.63.0")] @@ -1577,8 +1577,8 @@ impl<'b, T: ?Sized> RefMut<'b, T> { /// /// let c = RefCell::new((5, 'b')); /// { - /// let b1: RefMut<(u32, char)> = c.borrow_mut(); - /// let mut b2: RefMut = RefMut::map(b1, |t| &mut t.0); + /// let b1: RefMut<'_, (u32, char)> = c.borrow_mut(); + /// let mut b2: RefMut<'_, u32> = RefMut::map(b1, |t| &mut t.0); /// assert_eq!(*b2, 5); /// *b2 = 42; /// } @@ -1612,8 +1612,8 @@ impl<'b, T: ?Sized> RefMut<'b, T> { /// let c = RefCell::new(vec![1, 2, 3]); /// /// { - /// let b1: RefMut> = c.borrow_mut(); - /// let mut b2: Result, _> = RefMut::filter_map(b1, |v| v.get_mut(1)); + /// let b1: RefMut<'_, Vec> = c.borrow_mut(); + /// let mut b2: Result, _> = RefMut::filter_map(b1, |v| v.get_mut(1)); /// /// if let Ok(mut b2) = b2 { /// *b2 += 2; diff --git a/library/core/src/fmt/builders.rs b/library/core/src/fmt/builders.rs index d1c6b67b2788..36f49d51ca6d 100644 --- a/library/core/src/fmt/builders.rs +++ b/library/core/src/fmt/builders.rs @@ -60,7 +60,7 @@ impl fmt::Write for PadAdapter<'_, '_> { /// } /// /// impl fmt::Debug for Foo { -/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { +/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_struct("Foo") /// .field("bar", &self.bar) /// .field("baz", &self.baz) @@ -249,7 +249,7 @@ impl<'a, 'b: 'a> DebugStruct<'a, 'b> { /// struct Foo(i32, String); /// /// impl fmt::Debug for Foo { -/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { +/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_tuple("Foo") /// .field(&self.0) /// .field(&self.1) @@ -418,7 +418,7 @@ impl<'a, 'b: 'a> DebugInner<'a, 'b> { /// struct Foo(Vec); /// /// impl fmt::Debug for Foo { -/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { +/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_set().entries(self.0.iter()).finish() /// } /// } @@ -548,7 +548,7 @@ impl<'a, 'b: 'a> DebugSet<'a, 'b> { /// struct Foo(Vec); /// /// impl fmt::Debug for Foo { -/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { +/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_list().entries(self.0.iter()).finish() /// } /// } @@ -678,7 +678,7 @@ impl<'a, 'b: 'a> DebugList<'a, 'b> { /// struct Foo(Vec<(String, i32)>); /// /// impl fmt::Debug for Foo { -/// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { +/// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_map().entries(self.0.iter().map(|&(ref k, ref v)| (k, v))).finish() /// } /// } diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index a901ae726698..2138fafeaaf5 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -534,7 +534,7 @@ impl<'a> Arguments<'a> { /// /// fn write_str(_: &str) { /* ... */ } /// - /// fn write_fmt(args: &Arguments) { + /// fn write_fmt(args: &Arguments<'_>) { /// if let Some(s) = args.as_str() { /// write_str(s) /// } else { @@ -1381,7 +1381,7 @@ impl<'a> Formatter<'a> { /// } /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// // We need to remove "-" from the number output. /// let tmp = self.nb.abs().to_string(); /// @@ -1481,7 +1481,7 @@ impl<'a> Formatter<'a> { /// struct Foo; /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// formatter.pad("Foo") /// } /// } @@ -1663,7 +1663,7 @@ impl<'a> Formatter<'a> { /// struct Foo; /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// formatter.write_str("Foo") /// // This is equivalent to: /// // write!(formatter, "Foo") @@ -1688,7 +1688,7 @@ impl<'a> Formatter<'a> { /// struct Foo(i32); /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// formatter.write_fmt(format_args!("Foo {}", self.0)) /// } /// } @@ -1723,7 +1723,7 @@ impl<'a> Formatter<'a> { /// struct Foo; /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// let c = formatter.fill(); /// if let Some(width) = formatter.width() { /// for _ in 0..width { @@ -1751,14 +1751,12 @@ impl<'a> Formatter<'a> { /// # Examples /// /// ``` - /// extern crate core; - /// /// use std::fmt::{self, Alignment}; /// /// struct Foo; /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// let s = if let Some(s) = formatter.align() { /// match s { /// Alignment::Left => "left", @@ -1798,7 +1796,7 @@ impl<'a> Formatter<'a> { /// struct Foo(i32); /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// if let Some(width) = formatter.width() { /// // If we received a width, we use it /// write!(formatter, "{:width$}", format!("Foo({})", self.0), width = width) @@ -1829,7 +1827,7 @@ impl<'a> Formatter<'a> { /// struct Foo(f32); /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// if let Some(precision) = formatter.precision() { /// // If we received a precision, we use it. /// write!(formatter, "Foo({1:.*})", precision, self.0) @@ -1859,7 +1857,7 @@ impl<'a> Formatter<'a> { /// struct Foo(i32); /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// if formatter.sign_plus() { /// write!(formatter, /// "Foo({}{})", @@ -1891,7 +1889,7 @@ impl<'a> Formatter<'a> { /// struct Foo(i32); /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// if formatter.sign_minus() { /// // You want a minus sign? Have one! /// write!(formatter, "-Foo({})", self.0) @@ -1920,7 +1918,7 @@ impl<'a> Formatter<'a> { /// struct Foo(i32); /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// if formatter.alternate() { /// write!(formatter, "Foo({})", self.0) /// } else { @@ -1948,7 +1946,7 @@ impl<'a> Formatter<'a> { /// struct Foo(i32); /// /// impl fmt::Display for Foo { - /// fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result { /// assert!(formatter.sign_aware_zero_pad()); /// assert_eq!(formatter.width(), Some(4)); /// // We ignore the formatter's options. @@ -1992,7 +1990,7 @@ impl<'a> Formatter<'a> { /// } /// /// impl fmt::Debug for Foo { - /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_struct("Foo") /// .field("bar", &self.bar) /// .field("baz", &self.baz) @@ -2150,7 +2148,7 @@ impl<'a> Formatter<'a> { /// struct Foo(i32, String, PhantomData); /// /// impl fmt::Debug for Foo { - /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_tuple("Foo") /// .field(&self.0) /// .field(&self.1) @@ -2282,7 +2280,7 @@ impl<'a> Formatter<'a> { /// struct Foo(Vec); /// /// impl fmt::Debug for Foo { - /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_list().entries(self.0.iter()).finish() /// } /// } @@ -2305,7 +2303,7 @@ impl<'a> Formatter<'a> { /// struct Foo(Vec); /// /// impl fmt::Debug for Foo { - /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_set().entries(self.0.iter()).finish() /// } /// } @@ -2321,14 +2319,14 @@ impl<'a> Formatter<'a> { /// ```rust /// use std::fmt; /// - /// struct Arm<'a, L: 'a, R: 'a>(&'a (L, R)); - /// struct Table<'a, K: 'a, V: 'a>(&'a [(K, V)], V); + /// struct Arm<'a, L, R>(&'a (L, R)); + /// struct Table<'a, K, V>(&'a [(K, V)], V); /// /// impl<'a, L, R> fmt::Debug for Arm<'a, L, R> /// where /// L: 'a + fmt::Debug, R: 'a + fmt::Debug /// { - /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// L::fmt(&(self.0).0, fmt)?; /// fmt.write_str(" => ")?; /// R::fmt(&(self.0).1, fmt) @@ -2339,7 +2337,7 @@ impl<'a> Formatter<'a> { /// where /// K: 'a + fmt::Debug, V: 'a + fmt::Debug /// { - /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_set() /// .entries(self.0.iter().map(Arm)) /// .entry(&Arm(&(format_args!("_"), &self.1))) @@ -2363,7 +2361,7 @@ impl<'a> Formatter<'a> { /// struct Foo(Vec<(String, i32)>); /// /// impl fmt::Debug for Foo { - /// fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + /// fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { /// fmt.debug_map().entries(self.0.iter().map(|&(ref k, ref v)| (k, v))).finish() /// } /// } diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs index 45498a54b25d..b4639c07c351 100644 --- a/library/core/src/intrinsics/mir.rs +++ b/library/core/src/intrinsics/mir.rs @@ -15,7 +15,6 @@ //! ```rust //! #![feature(core_intrinsics, custom_mir)] //! -//! extern crate core; //! use core::intrinsics::mir::*; //! //! #[custom_mir(dialect = "built")] @@ -65,7 +64,6 @@ //! ```rust //! #![feature(core_intrinsics, custom_mir)] //! -//! extern crate core; //! use core::intrinsics::mir::*; //! //! #[custom_mir(dialect = "built")] @@ -317,7 +315,6 @@ define!( /// ```rust /// #![feature(custom_mir, core_intrinsics)] /// - /// extern crate core; /// use core::intrinsics::mir::*; /// /// #[custom_mir(dialect = "built")] diff --git a/library/core/src/iter/adapters/chain.rs b/library/core/src/iter/adapters/chain.rs index 2046b70c9c6b..9fae9f6744cb 100644 --- a/library/core/src/iter/adapters/chain.rs +++ b/library/core/src/iter/adapters/chain.rs @@ -15,7 +15,7 @@ use crate::ops::Try; /// /// let a1 = [1, 2, 3]; /// let a2 = [4, 5, 6]; -/// let iter: Chain, Iter<_>> = a1.iter().chain(a2.iter()); +/// let iter: Chain, Iter<'_, _>> = a1.iter().chain(a2.iter()); /// ``` #[derive(Clone, Debug)] #[must_use = "iterators are lazy and do nothing unless consumed"] diff --git a/library/core/src/macros/mod.rs b/library/core/src/macros/mod.rs index 7c93c93b4a01..b24882ddb179 100644 --- a/library/core/src/macros/mod.rs +++ b/library/core/src/macros/mod.rs @@ -498,7 +498,6 @@ macro_rules! r#try { /// In a `no_std` setup you are responsible for the implementation details of the components. /// /// ```no_run -/// # extern crate core; /// use core::fmt::Write; /// /// struct Example; diff --git a/library/core/src/marker.rs b/library/core/src/marker.rs index e85c0c0a6889..c25a2a8bd15d 100644 --- a/library/core/src/marker.rs +++ b/library/core/src/marker.rs @@ -591,7 +591,7 @@ impl !Sync for *mut T {} /// use std::marker::PhantomData; /// /// # #[allow(dead_code)] -/// struct Slice<'a, T: 'a> { +/// struct Slice<'a, T> { /// start: *const T, /// end: *const T, /// phantom: PhantomData<&'a T>, @@ -607,7 +607,7 @@ impl !Sync for *mut T {} /// ``` /// # #![allow(dead_code)] /// # use std::marker::PhantomData; -/// # struct Slice<'a, T: 'a> { +/// # struct Slice<'a, T> { /// # start: *const T, /// # end: *const T, /// # phantom: PhantomData<&'a T>, diff --git a/library/core/src/ops/arith.rs b/library/core/src/ops/arith.rs index 1501dc4e38b7..840c8cd2fe8d 100644 --- a/library/core/src/ops/arith.rs +++ b/library/core/src/ops/arith.rs @@ -517,7 +517,7 @@ div_impl_float! { f32 f64 } /// use std::ops::Rem; /// /// #[derive(PartialEq, Debug)] -/// struct SplitSlice<'a, T: 'a> { +/// struct SplitSlice<'a, T> { /// slice: &'a [T], /// } /// diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 3df990e5dd9f..b82300428759 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -555,6 +555,7 @@ impl Copy for () { /// /// ``` /// # #![feature(rustc_private)] +/// #[allow(unused_extern_crates)] /// extern crate libc; /// /// use std::mem; diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index be6dc7768af9..eb46f4e54bb6 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -2287,7 +2287,7 @@ mod use_keyword {} /// # #![allow(dead_code)] /// pub enum Cow<'a, B> /// where -/// B: 'a + ToOwned + ?Sized, +/// B: ToOwned + ?Sized, /// { /// Borrowed(&'a B), /// Owned(::Owned), diff --git a/library/std/src/os/unix/fs.rs b/library/std/src/os/unix/fs.rs index a0e664acd130..1e1c36931054 100644 --- a/library/std/src/os/unix/fs.rs +++ b/library/std/src/os/unix/fs.rs @@ -368,7 +368,7 @@ pub trait OpenOptionsExt { /// /// ```no_run /// # #![feature(rustc_private)] - /// extern crate libc; + /// use libc; /// use std::fs::OpenOptions; /// use std::os::unix::fs::OpenOptionsExt; /// diff --git a/library/std/src/path.rs b/library/std/src/path.rs index e5abd02a1bc5..19d19bb045ef 100644 --- a/library/std/src/path.rs +++ b/library/std/src/path.rs @@ -117,7 +117,7 @@ use crate::sys::path::{is_sep_byte, is_verbatim_sep, parse_prefix, MAIN_SEP_STR} /// use std::path::Prefix::*; /// use std::ffi::OsStr; /// -/// fn get_path_prefix(s: &str) -> Prefix { +/// fn get_path_prefix(s: &str) -> Prefix<'_> { /// let path = Path::new(s); /// match path.components().next().unwrap() { /// Component::Prefix(prefix_component) => prefix_component.kind(), diff --git a/library/std/src/primitive_docs.rs b/library/std/src/primitive_docs.rs index 3df990e5dd9f..b82300428759 100644 --- a/library/std/src/primitive_docs.rs +++ b/library/std/src/primitive_docs.rs @@ -555,6 +555,7 @@ impl Copy for () { /// /// ``` /// # #![feature(rustc_private)] +/// #[allow(unused_extern_crates)] /// extern crate libc; /// /// use std::mem; diff --git a/library/std/src/process.rs b/library/std/src/process.rs index 0ab72f7ea7a6..41e450499cee 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -1835,7 +1835,7 @@ impl ExitCode { /// # use std::fmt; /// # enum UhOhError { GenericProblem, Specific, WithCode { exit_code: ExitCode, _x: () } } /// # impl fmt::Display for UhOhError { - /// # fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { unimplemented!() } + /// # fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result { unimplemented!() } /// # } /// // there's no way to gracefully recover from an UhOhError, so we just /// // print a message and exit diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 0d2d512b4b2a..e9c91ef06766 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -2146,6 +2146,10 @@ impl<'a> Builder<'a> { #[cfg(test)] mod tests; +/// Represents flag values in `String` form with whitespace delimiter to pass it to the compiler later. +/// +/// `-Z crate-attr` flags will be applied recursively on the target code using the `rustc_parse::parser::Parser`. +/// See `rustc_builtin_macros::cmdline_attrs::inject` for more information. #[derive(Debug, Clone)] struct Rustflags(String, TargetSelection); diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 7d2a6862500a..1de9f592a274 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -412,6 +412,8 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car format!("-Zcrate-attr=doc(html_root_url=\"{}/\")", builder.doc_rust_lang_org_channel(),); cargo.rustflag(&html_root); cargo.rustdocflag(&html_root); + + cargo.rustdocflag("-Zcrate-attr=warn(rust_2018_idioms)"); } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] @@ -810,6 +812,9 @@ pub fn rustc_cargo(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetSelec .arg(builder.rustc_features(builder.kind)) .arg("--manifest-path") .arg(builder.src.join("compiler/rustc/Cargo.toml")); + + cargo.rustdocflag("-Zcrate-attr=warn(rust_2018_idioms)"); + rustc_cargo_env(builder, cargo, target, stage); } From 0b9feea0a406b2eb082a8f92d5632d6802cfd60e Mon Sep 17 00:00:00 2001 From: Urgau Date: Sun, 7 May 2023 00:35:55 +0200 Subject: [PATCH 43/97] Update hashbrown from 0.12.3 to 0.13.1 for std --- Cargo.lock | 8 ++++---- library/std/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e71d8ceac8d..94cdc93a57b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1546,9 +1546,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ "ahash 0.7.4", - "compiler_builtins", - "rustc-std-workspace-alloc", - "rustc-std-workspace-core", ] [[package]] @@ -1558,6 +1555,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ff8ae62cd3a9102e5637afc8452c55acf3844001bd5374e0b0bd7b6616c038" dependencies = [ "ahash 0.8.2", + "compiler_builtins", + "rustc-std-workspace-alloc", + "rustc-std-workspace-core", ] [[package]] @@ -4606,7 +4606,7 @@ dependencies = [ "core", "dlmalloc", "fortanix-sgx-abi", - "hashbrown 0.12.3", + "hashbrown 0.13.1", "hermit-abi 0.3.0", "libc", "miniz_oxide", diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 72a5b4773306..0441f7e6c862 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -19,7 +19,7 @@ libc = { version = "0.2.142", default-features = false, features = ['rustc-dep-o compiler_builtins = { version = "0.1.91" } profiler_builtins = { path = "../profiler_builtins", optional = true } unwind = { path = "../unwind" } -hashbrown = { version = "0.12", default-features = false, features = ['rustc-dep-of-std'] } +hashbrown = { version = "0.13", default-features = false, features = ['rustc-dep-of-std'] } std_detect = { path = "../stdarch/crates/std_detect", default-features = false, features = ['rustc-dep-of-std'] } # Dependencies of the `backtrace` crate From ff855547f463aecb0c86f8f78ebc605ef097664b Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Sat, 6 May 2023 23:20:58 -0400 Subject: [PATCH 44/97] Rename InstCombine to InstSimplify --- .../src/{instcombine.rs => instsimplify.rs} | 50 +++++++++---------- compiler/rustc_mir_transform/src/lib.rs | 4 +- compiler/rustc_mir_transform/src/simplify.rs | 4 +- compiler/rustc_session/src/options.rs | 2 +- ...ff => bool_compare.opt1.InstSimplify.diff} | 4 +- ...ff => bool_compare.opt2.InstSimplify.diff} | 4 +- ...ff => bool_compare.opt3.InstSimplify.diff} | 4 +- ...ff => bool_compare.opt4.InstSimplify.diff} | 4 +- tests/mir-opt/bool_compare.rs | 10 ++-- ...diff => casts.redundant.InstSimplify.diff} | 4 +- tests/mir-opt/casts.rs | 2 +- ...combine_array_len.norm2.InstSimplify.diff} | 4 +- tests/mir-opt/combine_array_len.rs | 4 +- tests/mir-opt/combine_clone_of_primitives.rs | 4 +- ...imitives.{impl#0}-clone.InstSimplify.diff} | 4 +- ...ansmutes.adt_transmutes.InstSimplify.diff} | 4 +- ...tes.identity_transmutes.InstSimplify.diff} | 4 +- ...utes.integer_transmutes.InstSimplify.diff} | 4 +- tests/mir-opt/combine_transmutes.rs | 8 +-- tests/mir-opt/const_prop/slice_len.rs | 2 +- ...ont_yeet_assert.generic.InstSimplify.diff} | 4 +- tests/mir-opt/dont_yeet_assert.rs | 4 +- ....diff => equal_true.opt.InstSimplify.diff} | 4 +- tests/mir-opt/equal_true.rs | 4 +- ...tch_targets.assert_zero.InstSimplify.diff} | 16 +++--- ... instsimplify_duplicate_switch_targets.rs} | 4 +- ...trinsic_asserts.generic.InstSimplify.diff} | 4 +- ...ntrinsic_asserts.panics.InstSimplify.diff} | 4 +- ...insic_asserts.removable.InstSimplify.diff} | 4 +- tests/mir-opt/intrinsic_asserts.rs | 6 +-- ...e.diff => issue_78192.f.InstSimplify.diff} | 4 +- tests/mir-opt/issue_78192.rs | 2 +- ... => not_equal_false.opt.InstSimplify.diff} | 4 +- tests/mir-opt/not_equal_false.rs | 4 +- tests/ui/lint/invalid_value-polymorphic.rs | 2 +- 35 files changed, 100 insertions(+), 100 deletions(-) rename compiler/rustc_mir_transform/src/{instcombine.rs => instsimplify.rs} (87%) rename tests/mir-opt/{bool_compare.opt1.InstCombine.diff => bool_compare.opt1.InstSimplify.diff} (95%) rename tests/mir-opt/{bool_compare.opt2.InstCombine.diff => bool_compare.opt2.InstSimplify.diff} (95%) rename tests/mir-opt/{bool_compare.opt3.InstCombine.diff => bool_compare.opt3.InstSimplify.diff} (95%) rename tests/mir-opt/{bool_compare.opt4.InstCombine.diff => bool_compare.opt4.InstSimplify.diff} (95%) rename tests/mir-opt/{casts.redundant.InstCombine.diff => casts.redundant.InstSimplify.diff} (93%) rename tests/mir-opt/{combine_array_len.norm2.InstCombine.diff => combine_array_len.norm2.InstSimplify.diff} (98%) rename tests/mir-opt/{combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff => combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff} (98%) rename tests/mir-opt/{combine_transmutes.adt_transmutes.InstCombine.diff => combine_transmutes.adt_transmutes.InstSimplify.diff} (99%) rename tests/mir-opt/{combine_transmutes.identity_transmutes.InstCombine.diff => combine_transmutes.identity_transmutes.InstSimplify.diff} (95%) rename tests/mir-opt/{combine_transmutes.integer_transmutes.InstCombine.diff => combine_transmutes.integer_transmutes.InstSimplify.diff} (93%) rename tests/mir-opt/{dont_yeet_assert.generic.InstCombine.diff => dont_yeet_assert.generic.InstSimplify.diff} (93%) rename tests/mir-opt/{equal_true.opt.InstCombine.diff => equal_true.opt.InstSimplify.diff} (95%) rename tests/mir-opt/{instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff => instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff} (52%) rename tests/mir-opt/{instcombine_duplicate_switch_targets.rs => instsimplify_duplicate_switch_targets.rs} (82%) rename tests/mir-opt/{intrinsic_asserts.generic.InstCombine.diff => intrinsic_asserts.generic.InstSimplify.diff} (96%) rename tests/mir-opt/{intrinsic_asserts.panics.InstCombine.diff => intrinsic_asserts.panics.InstSimplify.diff} (97%) rename tests/mir-opt/{intrinsic_asserts.removable.InstCombine.diff => intrinsic_asserts.removable.InstSimplify.diff} (97%) rename tests/mir-opt/{issue_78192.f.InstCombine.diff => issue_78192.f.InstSimplify.diff} (95%) rename tests/mir-opt/{not_equal_false.opt.InstCombine.diff => not_equal_false.opt.InstSimplify.diff} (95%) diff --git a/compiler/rustc_mir_transform/src/instcombine.rs b/compiler/rustc_mir_transform/src/instsimplify.rs similarity index 87% rename from compiler/rustc_mir_transform/src/instcombine.rs rename to compiler/rustc_mir_transform/src/instsimplify.rs index 432852a1fddc..6bff535586ad 100644 --- a/compiler/rustc_mir_transform/src/instcombine.rs +++ b/compiler/rustc_mir_transform/src/instsimplify.rs @@ -1,6 +1,6 @@ //! Performs various peephole optimizations. -use crate::simplify::combine_duplicate_switch_targets; +use crate::simplify::simplify_duplicate_switch_targets; use crate::MirPass; use rustc_hir::Mutability; use rustc_middle::mir::*; @@ -10,15 +10,15 @@ use rustc_middle::ty::{self, ParamEnv, SubstsRef, Ty, TyCtxt}; use rustc_span::symbol::Symbol; use rustc_target::abi::FieldIdx; -pub struct InstCombine; +pub struct InstSimplify; -impl<'tcx> MirPass<'tcx> for InstCombine { +impl<'tcx> MirPass<'tcx> for InstSimplify { fn is_enabled(&self, sess: &rustc_session::Session) -> bool { sess.mir_opt_level() > 0 } fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let ctx = InstCombineContext { + let ctx = InstSimplifyContext { tcx, local_decls: &body.local_decls, param_env: tcx.param_env_reveal_all_normalized(body.source.def_id()), @@ -27,43 +27,43 @@ impl<'tcx> MirPass<'tcx> for InstCombine { for statement in block.statements.iter_mut() { match statement.kind { StatementKind::Assign(box (_place, ref mut rvalue)) => { - ctx.combine_bool_cmp(&statement.source_info, rvalue); - ctx.combine_ref_deref(&statement.source_info, rvalue); - ctx.combine_len(&statement.source_info, rvalue); - ctx.combine_cast(&statement.source_info, rvalue); + ctx.simplify_bool_cmp(&statement.source_info, rvalue); + ctx.simplify_ref_deref(&statement.source_info, rvalue); + ctx.simplify_len(&statement.source_info, rvalue); + ctx.simplify_cast(&statement.source_info, rvalue); } _ => {} } } - ctx.combine_primitive_clone( + ctx.simplify_primitive_clone( &mut block.terminator.as_mut().unwrap(), &mut block.statements, ); - ctx.combine_intrinsic_assert( + ctx.simplify_intrinsic_assert( &mut block.terminator.as_mut().unwrap(), &mut block.statements, ); - combine_duplicate_switch_targets(block.terminator.as_mut().unwrap()); + simplify_duplicate_switch_targets(block.terminator.as_mut().unwrap()); } } } -struct InstCombineContext<'tcx, 'a> { +struct InstSimplifyContext<'tcx, 'a> { tcx: TyCtxt<'tcx>, local_decls: &'a LocalDecls<'tcx>, param_env: ParamEnv<'tcx>, } -impl<'tcx> InstCombineContext<'tcx, '_> { - fn should_combine(&self, source_info: &SourceInfo, rvalue: &Rvalue<'tcx>) -> bool { +impl<'tcx> InstSimplifyContext<'tcx, '_> { + fn should_simplify(&self, source_info: &SourceInfo, rvalue: &Rvalue<'tcx>) -> bool { self.tcx.consider_optimizing(|| { - format!("InstCombine - Rvalue: {:?} SourceInfo: {:?}", rvalue, source_info) + format!("InstSimplify - Rvalue: {:?} SourceInfo: {:?}", rvalue, source_info) }) } /// Transform boolean comparisons into logical operations. - fn combine_bool_cmp(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { + fn simplify_bool_cmp(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { match rvalue { Rvalue::BinaryOp(op @ (BinOp::Eq | BinOp::Ne), box (a, b)) => { let new = match (op, self.try_eval_bool(a), self.try_eval_bool(b)) { @@ -94,7 +94,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { _ => None, }; - if let Some(new) = new && self.should_combine(source_info, rvalue) { + if let Some(new) = new && self.should_simplify(source_info, rvalue) { *rvalue = new; } } @@ -109,14 +109,14 @@ impl<'tcx> InstCombineContext<'tcx, '_> { } /// Transform "&(*a)" ==> "a". - fn combine_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { + fn simplify_ref_deref(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { if let Rvalue::Ref(_, _, place) = rvalue { if let Some((base, ProjectionElem::Deref)) = place.as_ref().last_projection() { if rvalue.ty(self.local_decls, self.tcx) != base.ty(self.local_decls, self.tcx).ty { return; } - if !self.should_combine(source_info, rvalue) { + if !self.should_simplify(source_info, rvalue) { return; } @@ -129,11 +129,11 @@ impl<'tcx> InstCombineContext<'tcx, '_> { } /// Transform "Len([_; N])" ==> "N". - fn combine_len(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { + fn simplify_len(&self, source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { if let Rvalue::Len(ref place) = *rvalue { let place_ty = place.ty(self.local_decls, self.tcx).ty; if let ty::Array(_, len) = *place_ty.kind() { - if !self.should_combine(source_info, rvalue) { + if !self.should_simplify(source_info, rvalue) { return; } @@ -144,7 +144,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { } } - fn combine_cast(&self, _source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { + fn simplify_cast(&self, _source_info: &SourceInfo, rvalue: &mut Rvalue<'tcx>) { if let Rvalue::Cast(kind, operand, cast_ty) = rvalue { let operand_ty = operand.ty(self.local_decls, self.tcx); if operand_ty == *cast_ty { @@ -196,7 +196,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { } } - fn combine_primitive_clone( + fn simplify_primitive_clone( &self, terminator: &mut Terminator<'tcx>, statements: &mut Vec>, @@ -239,7 +239,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { if !self.tcx.consider_optimizing(|| { format!( - "InstCombine - Call: {:?} SourceInfo: {:?}", + "InstSimplify - Call: {:?} SourceInfo: {:?}", (fn_def_id, fn_substs), terminator.source_info ) @@ -262,7 +262,7 @@ impl<'tcx> InstCombineContext<'tcx, '_> { terminator.kind = TerminatorKind::Goto { target: destination_block }; } - fn combine_intrinsic_assert( + fn simplify_intrinsic_assert( &self, terminator: &mut Terminator<'tcx>, _statements: &mut Vec>, diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 8d9a22ea30dd..f25a9f042c4f 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -73,7 +73,7 @@ mod ffi_unwind_calls; mod function_item_references; mod generator; mod inline; -mod instcombine; +mod instsimplify; mod large_enums; mod lower_intrinsics; mod lower_slice_len; @@ -547,7 +547,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &match_branches::MatchBranchSimplification, // inst combine is after MatchBranchSimplification to clean up Ne(_1, false) &multiple_return_terminators::MultipleReturnTerminators, - &instcombine::InstCombine, + &instsimplify::InstSimplify, &separate_const_switch::SeparateConstSwitch, &simplify::SimplifyLocals::BeforeConstProp, ©_prop::CopyProp, diff --git a/compiler/rustc_mir_transform/src/simplify.rs b/compiler/rustc_mir_transform/src/simplify.rs index 7e0cef025f7f..1b96df3aed5b 100644 --- a/compiler/rustc_mir_transform/src/simplify.rs +++ b/compiler/rustc_mir_transform/src/simplify.rs @@ -278,7 +278,7 @@ impl<'a, 'tcx> CfgSimplifier<'a, 'tcx> { } } -pub fn combine_duplicate_switch_targets(terminator: &mut Terminator<'_>) { +pub fn simplify_duplicate_switch_targets(terminator: &mut Terminator<'_>) { if let TerminatorKind::SwitchInt { targets, .. } = &mut terminator.kind { let otherwise = targets.otherwise(); if targets.iter().any(|t| t.1 == otherwise) { @@ -310,7 +310,7 @@ pub fn remove_duplicate_unreachable_blocks<'tcx>(tcx: TyCtxt<'tcx>, body: &mut B } } - combine_duplicate_switch_targets(terminator); + simplify_duplicate_switch_targets(terminator); self.super_terminator(terminator, location); } diff --git a/compiler/rustc_session/src/options.rs b/compiler/rustc_session/src/options.rs index 243da98c3c28..5cbd7f98b6be 100644 --- a/compiler/rustc_session/src/options.rs +++ b/compiler/rustc_session/src/options.rs @@ -1555,7 +1555,7 @@ options! { "emit Retagging MIR statements, interpreted e.g., by miri; implies -Zmir-opt-level=0 \ (default: no)"), mir_enable_passes: Vec<(String, bool)> = (Vec::new(), parse_list_with_polarity, [TRACKED], - "use like `-Zmir-enable-passes=+DestProp,-InstCombine`. Forces the specified passes to be \ + "use like `-Zmir-enable-passes=+DestinationPropagation,-InstSimplify`. Forces the specified passes to be \ enabled, overriding all other checks. Passes that are not specified are enabled or \ disabled by other flags as usual."), mir_keep_place_mention: bool = (false, parse_bool, [TRACKED], diff --git a/tests/mir-opt/bool_compare.opt1.InstCombine.diff b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff similarity index 95% rename from tests/mir-opt/bool_compare.opt1.InstCombine.diff rename to tests/mir-opt/bool_compare.opt1.InstSimplify.diff index 0af5d82d3154..6c9df8f042b7 100644 --- a/tests/mir-opt/bool_compare.opt1.InstCombine.diff +++ b/tests/mir-opt/bool_compare.opt1.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt1` before InstCombine -+ // MIR for `opt1` after InstCombine +- // MIR for `opt1` before InstSimplify ++ // MIR for `opt1` after InstSimplify fn opt1(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 diff --git a/tests/mir-opt/bool_compare.opt2.InstCombine.diff b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff similarity index 95% rename from tests/mir-opt/bool_compare.opt2.InstCombine.diff rename to tests/mir-opt/bool_compare.opt2.InstSimplify.diff index f5d1febd991c..9fb3982654ab 100644 --- a/tests/mir-opt/bool_compare.opt2.InstCombine.diff +++ b/tests/mir-opt/bool_compare.opt2.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt2` before InstCombine -+ // MIR for `opt2` after InstCombine +- // MIR for `opt2` before InstSimplify ++ // MIR for `opt2` after InstSimplify fn opt2(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 diff --git a/tests/mir-opt/bool_compare.opt3.InstCombine.diff b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff similarity index 95% rename from tests/mir-opt/bool_compare.opt3.InstCombine.diff rename to tests/mir-opt/bool_compare.opt3.InstSimplify.diff index e7432adac7d9..3a47da86735e 100644 --- a/tests/mir-opt/bool_compare.opt3.InstCombine.diff +++ b/tests/mir-opt/bool_compare.opt3.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt3` before InstCombine -+ // MIR for `opt3` after InstCombine +- // MIR for `opt3` before InstSimplify ++ // MIR for `opt3` after InstSimplify fn opt3(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 diff --git a/tests/mir-opt/bool_compare.opt4.InstCombine.diff b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff similarity index 95% rename from tests/mir-opt/bool_compare.opt4.InstCombine.diff rename to tests/mir-opt/bool_compare.opt4.InstSimplify.diff index 6b3e27772f71..5319c987d418 100644 --- a/tests/mir-opt/bool_compare.opt4.InstCombine.diff +++ b/tests/mir-opt/bool_compare.opt4.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt4` before InstCombine -+ // MIR for `opt4` after InstCombine +- // MIR for `opt4` before InstSimplify ++ // MIR for `opt4` after InstSimplify fn opt4(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/bool_compare.rs:+0:9: +0:10 diff --git a/tests/mir-opt/bool_compare.rs b/tests/mir-opt/bool_compare.rs index 4435bf5b0f2c..080f7f72d116 100644 --- a/tests/mir-opt/bool_compare.rs +++ b/tests/mir-opt/bool_compare.rs @@ -1,21 +1,21 @@ -// unit-test: InstCombine +// unit-test: InstSimplify -// EMIT_MIR bool_compare.opt1.InstCombine.diff +// EMIT_MIR bool_compare.opt1.InstSimplify.diff fn opt1(x: bool) -> u32 { if x != true { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt2.InstCombine.diff +// EMIT_MIR bool_compare.opt2.InstSimplify.diff fn opt2(x: bool) -> u32 { if true != x { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt3.InstCombine.diff +// EMIT_MIR bool_compare.opt3.InstSimplify.diff fn opt3(x: bool) -> u32 { if x == false { 0 } else { 1 } } -// EMIT_MIR bool_compare.opt4.InstCombine.diff +// EMIT_MIR bool_compare.opt4.InstSimplify.diff fn opt4(x: bool) -> u32 { if false == x { 0 } else { 1 } } diff --git a/tests/mir-opt/casts.redundant.InstCombine.diff b/tests/mir-opt/casts.redundant.InstSimplify.diff similarity index 93% rename from tests/mir-opt/casts.redundant.InstCombine.diff rename to tests/mir-opt/casts.redundant.InstSimplify.diff index 528a8e5a90f2..a641b69deb08 100644 --- a/tests/mir-opt/casts.redundant.InstCombine.diff +++ b/tests/mir-opt/casts.redundant.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `redundant` before InstCombine -+ // MIR for `redundant` after InstCombine +- // MIR for `redundant` before InstSimplify ++ // MIR for `redundant` after InstSimplify fn redundant(_1: *const &u8) -> *const &u8 { debug x => _1; // in scope 0 at $DIR/casts.rs:+0:30: +0:31 diff --git a/tests/mir-opt/casts.rs b/tests/mir-opt/casts.rs index 259c462da3d4..413b0e09d3fd 100644 --- a/tests/mir-opt/casts.rs +++ b/tests/mir-opt/casts.rs @@ -1,6 +1,6 @@ #![crate_type = "lib"] -// EMIT_MIR casts.redundant.InstCombine.diff +// EMIT_MIR casts.redundant.InstSimplify.diff // EMIT_MIR casts.redundant.PreCodegen.after.mir pub fn redundant<'a, 'b: 'a>(x: *const &'a u8) -> *const &'a u8 { generic_cast::<&'a u8, &'b u8>(x) as *const &'a u8 diff --git a/tests/mir-opt/combine_array_len.norm2.InstCombine.diff b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff similarity index 98% rename from tests/mir-opt/combine_array_len.norm2.InstCombine.diff rename to tests/mir-opt/combine_array_len.norm2.InstSimplify.diff index c73150f947df..0777007cefa6 100644 --- a/tests/mir-opt/combine_array_len.norm2.InstCombine.diff +++ b/tests/mir-opt/combine_array_len.norm2.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `norm2` before InstCombine -+ // MIR for `norm2` after InstCombine +- // MIR for `norm2` before InstSimplify ++ // MIR for `norm2` after InstSimplify fn norm2(_1: [f32; 2]) -> f32 { debug x => _1; // in scope 0 at $DIR/combine_array_len.rs:+0:10: +0:11 diff --git a/tests/mir-opt/combine_array_len.rs b/tests/mir-opt/combine_array_len.rs index 08c5f1a1fc55..970cafafcf04 100644 --- a/tests/mir-opt/combine_array_len.rs +++ b/tests/mir-opt/combine_array_len.rs @@ -1,6 +1,6 @@ // ignore-wasm32 compiled with panic=abort by default -// unit-test: InstCombine -// EMIT_MIR combine_array_len.norm2.InstCombine.diff +// unit-test: InstSimplify +// EMIT_MIR combine_array_len.norm2.InstSimplify.diff fn norm2(x: [f32; 2]) -> f32 { let a = x[0]; diff --git a/tests/mir-opt/combine_clone_of_primitives.rs b/tests/mir-opt/combine_clone_of_primitives.rs index 7cc50a86e21e..1deee9dd6d2f 100644 --- a/tests/mir-opt/combine_clone_of_primitives.rs +++ b/tests/mir-opt/combine_clone_of_primitives.rs @@ -1,7 +1,7 @@ -// unit-test: InstCombine +// unit-test: InstSimplify // ignore-wasm32 compiled with panic=abort by default -// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff +// EMIT_MIR combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff #[derive(Clone)] struct MyThing { diff --git a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff similarity index 98% rename from tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff rename to tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff index b715a544ffea..bb0811a7abb2 100644 --- a/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstCombine.diff +++ b/tests/mir-opt/combine_clone_of_primitives.{impl#0}-clone.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `::clone` before InstCombine -+ // MIR for `::clone` after InstCombine +- // MIR for `::clone` before InstSimplify ++ // MIR for `::clone` after InstSimplify fn ::clone(_1: &MyThing) -> MyThing { debug self => _1; // in scope 0 at $DIR/combine_clone_of_primitives.rs:+0:10: +0:15 diff --git a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff similarity index 99% rename from tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff rename to tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff index 168e8c610316..c5907e7cf180 100644 --- a/tests/mir-opt/combine_transmutes.adt_transmutes.InstCombine.diff +++ b/tests/mir-opt/combine_transmutes.adt_transmutes.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `adt_transmutes` before InstCombine -+ // MIR for `adt_transmutes` after InstCombine +- // MIR for `adt_transmutes` before InstSimplify ++ // MIR for `adt_transmutes` after InstSimplify fn adt_transmutes() -> () { let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:32: +0:32 diff --git a/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff similarity index 95% rename from tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff rename to tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff index ae1185c7f712..57d9f4b14023 100644 --- a/tests/mir-opt/combine_transmutes.identity_transmutes.InstCombine.diff +++ b/tests/mir-opt/combine_transmutes.identity_transmutes.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `identity_transmutes` before InstCombine -+ // MIR for `identity_transmutes` after InstCombine +- // MIR for `identity_transmutes` before InstSimplify ++ // MIR for `identity_transmutes` after InstSimplify fn identity_transmutes() -> () { let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:37: +0:37 diff --git a/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff similarity index 93% rename from tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff rename to tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff index 8de7c34e6b2d..ec7c982c151e 100644 --- a/tests/mir-opt/combine_transmutes.integer_transmutes.InstCombine.diff +++ b/tests/mir-opt/combine_transmutes.integer_transmutes.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `integer_transmutes` before InstCombine -+ // MIR for `integer_transmutes` after InstCombine +- // MIR for `integer_transmutes` before InstSimplify ++ // MIR for `integer_transmutes` after InstSimplify fn integer_transmutes() -> () { let mut _0: (); // return place in scope 0 at $DIR/combine_transmutes.rs:+0:36: +0:36 diff --git a/tests/mir-opt/combine_transmutes.rs b/tests/mir-opt/combine_transmutes.rs index de9b9c35c030..7088488c1b85 100644 --- a/tests/mir-opt/combine_transmutes.rs +++ b/tests/mir-opt/combine_transmutes.rs @@ -1,4 +1,4 @@ -// unit-test: InstCombine +// unit-test: InstSimplify // compile-flags: -C panic=abort #![crate_type = "lib"] @@ -8,7 +8,7 @@ use std::intrinsics::mir::*; use std::mem::{MaybeUninit, ManuallyDrop, transmute}; -// EMIT_MIR combine_transmutes.identity_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.identity_transmutes.InstSimplify.diff pub unsafe fn identity_transmutes() { // These are nops and should be removed let _a = transmute::(1); @@ -16,7 +16,7 @@ pub unsafe fn identity_transmutes() { } #[custom_mir(dialect = "runtime", phase = "initial")] -// EMIT_MIR combine_transmutes.integer_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.integer_transmutes.InstSimplify.diff pub unsafe fn integer_transmutes() { mir! { { @@ -30,7 +30,7 @@ pub unsafe fn integer_transmutes() { } } -// EMIT_MIR combine_transmutes.adt_transmutes.InstCombine.diff +// EMIT_MIR combine_transmutes.adt_transmutes.InstSimplify.diff pub unsafe fn adt_transmutes() { let _a: u8 = transmute(EnumNoRepr::A); let _a: i8 = transmute(EnumNoRepr::B); diff --git a/tests/mir-opt/const_prop/slice_len.rs b/tests/mir-opt/const_prop/slice_len.rs index 4499c54f264b..9821d1b1e922 100644 --- a/tests/mir-opt/const_prop/slice_len.rs +++ b/tests/mir-opt/const_prop/slice_len.rs @@ -1,6 +1,6 @@ // ignore-wasm32 compiled with panic=abort by default // unit-test: ConstProp -// compile-flags: -Zmir-enable-passes=+InstCombine +// compile-flags: -Zmir-enable-passes=+InstSimplify // EMIT_MIR_FOR_EACH_BIT_WIDTH // EMIT_MIR slice_len.main.ConstProp.diff diff --git a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff similarity index 93% rename from tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff rename to tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff index c0fc1fb1df37..cadf05152a43 100644 --- a/tests/mir-opt/dont_yeet_assert.generic.InstCombine.diff +++ b/tests/mir-opt/dont_yeet_assert.generic.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `generic` before InstCombine -+ // MIR for `generic` after InstCombine +- // MIR for `generic` before InstSimplify ++ // MIR for `generic` after InstSimplify fn generic() -> () { let mut _0: (); // return place in scope 0 at $DIR/dont_yeet_assert.rs:+0:21: +0:21 diff --git a/tests/mir-opt/dont_yeet_assert.rs b/tests/mir-opt/dont_yeet_assert.rs index 7cec761eabac..38cc5a293e87 100644 --- a/tests/mir-opt/dont_yeet_assert.rs +++ b/tests/mir-opt/dont_yeet_assert.rs @@ -1,11 +1,11 @@ // compile-flags: --crate-type=lib -// unit-test: InstCombine +// unit-test: InstSimplify #![feature(core_intrinsics)] // Want to make sure this assertion isn't compiled away in generic code. -// EMIT_MIR dont_yeet_assert.generic.InstCombine.diff +// EMIT_MIR dont_yeet_assert.generic.InstSimplify.diff pub fn generic() { core::intrinsics::assert_mem_uninitialized_valid::<&T>(); } diff --git a/tests/mir-opt/equal_true.opt.InstCombine.diff b/tests/mir-opt/equal_true.opt.InstSimplify.diff similarity index 95% rename from tests/mir-opt/equal_true.opt.InstCombine.diff rename to tests/mir-opt/equal_true.opt.InstSimplify.diff index 8b542a7c19d6..4ef4132008ea 100644 --- a/tests/mir-opt/equal_true.opt.InstCombine.diff +++ b/tests/mir-opt/equal_true.opt.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt` before InstCombine -+ // MIR for `opt` after InstCombine +- // MIR for `opt` before InstSimplify ++ // MIR for `opt` after InstSimplify fn opt(_1: bool) -> i32 { debug x => _1; // in scope 0 at $DIR/equal_true.rs:+0:8: +0:9 diff --git a/tests/mir-opt/equal_true.rs b/tests/mir-opt/equal_true.rs index 717d10c6d762..fbb5d8d37db8 100644 --- a/tests/mir-opt/equal_true.rs +++ b/tests/mir-opt/equal_true.rs @@ -1,6 +1,6 @@ -// unit-test InstCombine +// unit-test InstSimplify -// EMIT_MIR equal_true.opt.InstCombine.diff +// EMIT_MIR equal_true.opt.InstSimplify.diff fn opt(x: bool) -> i32 { if x == true { 0 } else { 1 } diff --git a/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff similarity index 52% rename from tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff rename to tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff index e04079453d21..04ba8dd8e4dd 100644 --- a/tests/mir-opt/instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff +++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff @@ -1,21 +1,21 @@ -- // MIR for `assert_zero` before InstCombine -+ // MIR for `assert_zero` after InstCombine +- // MIR for `assert_zero` before InstSimplify ++ // MIR for `assert_zero` after InstSimplify fn assert_zero(_1: u8) -> u8 { - let mut _0: u8; // return place in scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+0:37: +0:39 + let mut _0: u8; // return place in scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+0:37: +0:39 bb0: { -- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+3:13: +7:14 -+ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+3:13: +7:14 +- switchInt(_1) -> [0: bb2, 1: bb1, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14 ++ switchInt(_1) -> [0: bb2, otherwise: bb1]; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+3:13: +7:14 } bb1: { - unreachable; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+10:13: +10:26 + unreachable; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+10:13: +10:26 } bb2: { - _0 = _1; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+13:13: +13:20 - return; // scope 0 at $DIR/instcombine_duplicate_switch_targets.rs:+14:13: +14:21 + _0 = _1; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+13:13: +13:20 + return; // scope 0 at $DIR/instsimplify_duplicate_switch_targets.rs:+14:13: +14:21 } } diff --git a/tests/mir-opt/instcombine_duplicate_switch_targets.rs b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs similarity index 82% rename from tests/mir-opt/instcombine_duplicate_switch_targets.rs rename to tests/mir-opt/instsimplify_duplicate_switch_targets.rs index ef3b487afa32..3e280a40fda3 100644 --- a/tests/mir-opt/instcombine_duplicate_switch_targets.rs +++ b/tests/mir-opt/instsimplify_duplicate_switch_targets.rs @@ -3,9 +3,9 @@ use std::intrinsics::mir::*; -// unit-test: InstCombine +// unit-test: InstSimplify -// EMIT_MIR instcombine_duplicate_switch_targets.assert_zero.InstCombine.diff +// EMIT_MIR instsimplify_duplicate_switch_targets.assert_zero.InstSimplify.diff #[custom_mir(dialect = "runtime", phase = "post-cleanup")] pub unsafe fn assert_zero(x: u8) -> u8 { mir!( diff --git a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff similarity index 96% rename from tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff rename to tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff index 09fc145e734d..a59f4a43aede 100644 --- a/tests/mir-opt/intrinsic_asserts.generic.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.generic.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `generic` before InstCombine -+ // MIR for `generic` after InstCombine +- // MIR for `generic` before InstSimplify ++ // MIR for `generic` after InstSimplify fn generic() -> () { let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:21: +0:21 diff --git a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff similarity index 97% rename from tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff rename to tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff index c52174ef5ea2..195e8bd4eae0 100644 --- a/tests/mir-opt/intrinsic_asserts.panics.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.panics.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `panics` before InstCombine -+ // MIR for `panics` after InstCombine +- // MIR for `panics` before InstSimplify ++ // MIR for `panics` after InstSimplify fn panics() -> () { let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:17: +0:17 diff --git a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff similarity index 97% rename from tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff rename to tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff index d059d47ee586..a4a65074caa1 100644 --- a/tests/mir-opt/intrinsic_asserts.removable.InstCombine.diff +++ b/tests/mir-opt/intrinsic_asserts.removable.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `removable` before InstCombine -+ // MIR for `removable` after InstCombine +- // MIR for `removable` before InstSimplify ++ // MIR for `removable` after InstSimplify fn removable() -> () { let mut _0: (); // return place in scope 0 at $DIR/intrinsic_asserts.rs:+0:20: +0:20 diff --git a/tests/mir-opt/intrinsic_asserts.rs b/tests/mir-opt/intrinsic_asserts.rs index 8fb99cdf6e04..302d4bda188a 100644 --- a/tests/mir-opt/intrinsic_asserts.rs +++ b/tests/mir-opt/intrinsic_asserts.rs @@ -2,7 +2,7 @@ #![feature(core_intrinsics)] // All these assertions pass, so all the intrinsic calls should be deleted. -// EMIT_MIR intrinsic_asserts.removable.InstCombine.diff +// EMIT_MIR intrinsic_asserts.removable.InstSimplify.diff pub fn removable() { core::intrinsics::assert_inhabited::<()>(); core::intrinsics::assert_zero_valid::(); @@ -12,7 +12,7 @@ pub fn removable() { enum Never {} // These assertions all diverge, so their target blocks should become None. -// EMIT_MIR intrinsic_asserts.panics.InstCombine.diff +// EMIT_MIR intrinsic_asserts.panics.InstSimplify.diff pub fn panics() { core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::<&u8>(); @@ -20,7 +20,7 @@ pub fn panics() { } // Whether or not these asserts pass isn't known, so they shouldn't be modified. -// EMIT_MIR intrinsic_asserts.generic.InstCombine.diff +// EMIT_MIR intrinsic_asserts.generic.InstSimplify.diff pub fn generic() { core::intrinsics::assert_inhabited::(); core::intrinsics::assert_zero_valid::(); diff --git a/tests/mir-opt/issue_78192.f.InstCombine.diff b/tests/mir-opt/issue_78192.f.InstSimplify.diff similarity index 95% rename from tests/mir-opt/issue_78192.f.InstCombine.diff rename to tests/mir-opt/issue_78192.f.InstSimplify.diff index 116ca304c993..914d7ceb29a9 100644 --- a/tests/mir-opt/issue_78192.f.InstCombine.diff +++ b/tests/mir-opt/issue_78192.f.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `f` before InstCombine -+ // MIR for `f` after InstCombine +- // MIR for `f` before InstSimplify ++ // MIR for `f` after InstSimplify fn f(_1: &T) -> *const T { debug a => _1; // in scope 0 at $DIR/issue_78192.rs:+0:13: +0:14 diff --git a/tests/mir-opt/issue_78192.rs b/tests/mir-opt/issue_78192.rs index 39f665402b02..95142a3e4633 100644 --- a/tests/mir-opt/issue_78192.rs +++ b/tests/mir-opt/issue_78192.rs @@ -8,4 +8,4 @@ fn main() { f(&2); } -// EMIT_MIR issue_78192.f.InstCombine.diff +// EMIT_MIR issue_78192.f.InstSimplify.diff diff --git a/tests/mir-opt/not_equal_false.opt.InstCombine.diff b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff similarity index 95% rename from tests/mir-opt/not_equal_false.opt.InstCombine.diff rename to tests/mir-opt/not_equal_false.opt.InstSimplify.diff index b558c35ac1ee..8e7776a0bbca 100644 --- a/tests/mir-opt/not_equal_false.opt.InstCombine.diff +++ b/tests/mir-opt/not_equal_false.opt.InstSimplify.diff @@ -1,5 +1,5 @@ -- // MIR for `opt` before InstCombine -+ // MIR for `opt` after InstCombine +- // MIR for `opt` before InstSimplify ++ // MIR for `opt` after InstSimplify fn opt(_1: bool) -> u32 { debug x => _1; // in scope 0 at $DIR/not_equal_false.rs:+0:8: +0:9 diff --git a/tests/mir-opt/not_equal_false.rs b/tests/mir-opt/not_equal_false.rs index 2ae03da40f8a..e05607329000 100644 --- a/tests/mir-opt/not_equal_false.rs +++ b/tests/mir-opt/not_equal_false.rs @@ -1,5 +1,5 @@ -// unit-test: InstCombine -// EMIT_MIR not_equal_false.opt.InstCombine.diff +// unit-test: InstSimplify +// EMIT_MIR not_equal_false.opt.InstSimplify.diff fn opt(x: bool) -> u32 { if x != false { 0 } else { 1 } diff --git a/tests/ui/lint/invalid_value-polymorphic.rs b/tests/ui/lint/invalid_value-polymorphic.rs index 055173e9842d..98f82b792fcc 100644 --- a/tests/ui/lint/invalid_value-polymorphic.rs +++ b/tests/ui/lint/invalid_value-polymorphic.rs @@ -1,4 +1,4 @@ -// compile-flags: --crate-type=lib -Zmir-enable-passes=+InstCombine +// compile-flags: --crate-type=lib -Zmir-enable-passes=+InstSimplify // build-pass #![feature(core_intrinsics)] From e5d10cdbc36d80dcfa1c25ce6bd64b213674fe74 Mon Sep 17 00:00:00 2001 From: Kyle Matsuda Date: Mon, 20 Feb 2023 12:46:39 -0700 Subject: [PATCH 45/97] make (try_)subst_and_normalize_erasing_regions take EarlyBinder --- .../rustc_codegen_llvm/src/debuginfo/create_scope_map.rs | 2 +- compiler/rustc_codegen_llvm/src/debuginfo/mod.rs | 2 +- compiler/rustc_middle/src/ty/instance.rs | 6 +++--- compiler/rustc_middle/src/ty/normalize_erasing_regions.rs | 8 ++++---- compiler/rustc_monomorphize/src/partitioning/default.rs | 2 +- compiler/rustc_monomorphize/src/util.rs | 4 ++-- compiler/rustc_ty_utils/src/instance.rs | 3 +-- .../clippy_lints/src/methods/unnecessary_to_owned.rs | 2 +- 8 files changed, 14 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs index 2f910c37d610..3fff112a0205 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/create_scope_map.rs @@ -93,7 +93,7 @@ fn make_mir_scope<'ll, 'tcx>( let callee = cx.tcx.subst_and_normalize_erasing_regions( instance.substs, ty::ParamEnv::reveal_all(), - callee, + ty::EarlyBinder(callee), ); let callee_fn_abi = cx.fn_abi_of_instance(callee, ty::List::empty()); cx.dbg_scope_fn(callee, callee_fn_abi, None) diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs index b138b0c0e70a..c3f0a0033b0e 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/mod.rs @@ -529,7 +529,7 @@ impl<'ll, 'tcx> DebugInfoMethods<'tcx> for CodegenCx<'ll, 'tcx> { let impl_self_ty = cx.tcx.subst_and_normalize_erasing_regions( instance.substs, ty::ParamEnv::reveal_all(), - cx.tcx.type_of(impl_def_id).skip_binder(), + cx.tcx.type_of(impl_def_id), ); // Only "class" methods are generally understood by LLVM, diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index 6c8f4af75943..be584148595b 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -115,7 +115,7 @@ impl<'tcx> Instance<'tcx> { /// lifetimes erased, allowing a `ParamEnv` to be specified for use during normalization. pub fn ty(&self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>) -> Ty<'tcx> { let ty = tcx.type_of(self.def.def_id()); - tcx.subst_and_normalize_erasing_regions(self.substs, param_env, ty.skip_binder()) + tcx.subst_and_normalize_erasing_regions(self.substs, param_env, ty) } /// Finds a crate that contains a monomorphization of this instance that @@ -600,7 +600,7 @@ impl<'tcx> Instance<'tcx> { T: TypeFoldable> + Clone, { if let Some(substs) = self.substs_for_mir_body() { - tcx.subst_and_normalize_erasing_regions(substs, param_env, v) + tcx.subst_and_normalize_erasing_regions(substs, param_env, ty::EarlyBinder(v)) } else { tcx.normalize_erasing_regions(param_env, v) } @@ -617,7 +617,7 @@ impl<'tcx> Instance<'tcx> { T: TypeFoldable> + Clone, { if let Some(substs) = self.substs_for_mir_body() { - tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v) + tcx.try_subst_and_normalize_erasing_regions(substs, param_env, ty::EarlyBinder(v)) } else { tcx.try_normalize_erasing_regions(param_env, v) } diff --git a/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs b/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs index 7c59879a187f..9332b0430ffc 100644 --- a/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs +++ b/compiler/rustc_middle/src/ty/normalize_erasing_regions.rs @@ -139,7 +139,7 @@ impl<'tcx> TyCtxt<'tcx> { self, param_substs: SubstsRef<'tcx>, param_env: ty::ParamEnv<'tcx>, - value: T, + value: EarlyBinder, ) -> T where T: TypeFoldable>, @@ -151,7 +151,7 @@ impl<'tcx> TyCtxt<'tcx> { param_env={:?})", param_substs, value, param_env, ); - let substituted = EarlyBinder(value).subst(self, param_substs); + let substituted = value.subst(self, param_substs); self.normalize_erasing_regions(param_env, substituted) } @@ -163,7 +163,7 @@ impl<'tcx> TyCtxt<'tcx> { self, param_substs: SubstsRef<'tcx>, param_env: ty::ParamEnv<'tcx>, - value: T, + value: EarlyBinder, ) -> Result> where T: TypeFoldable>, @@ -175,7 +175,7 @@ impl<'tcx> TyCtxt<'tcx> { param_env={:?})", param_substs, value, param_env, ); - let substituted = EarlyBinder(value).subst(self, param_substs); + let substituted = value.subst(self, param_substs); self.try_normalize_erasing_regions(param_env, substituted) } } diff --git a/compiler/rustc_monomorphize/src/partitioning/default.rs b/compiler/rustc_monomorphize/src/partitioning/default.rs index 03183a406603..37b7f6bf8a8f 100644 --- a/compiler/rustc_monomorphize/src/partitioning/default.rs +++ b/compiler/rustc_monomorphize/src/partitioning/default.rs @@ -310,7 +310,7 @@ fn characteristic_def_id_of_mono_item<'tcx>( let impl_self_ty = tcx.subst_and_normalize_erasing_regions( instance.substs, ty::ParamEnv::reveal_all(), - tcx.type_of(impl_def_id).skip_binder(), + tcx.type_of(impl_def_id), ); if let Some(def_id) = characteristic_def_id_of_type(impl_self_ty) { return Some(def_id); diff --git a/compiler/rustc_monomorphize/src/util.rs b/compiler/rustc_monomorphize/src/util.rs index 33e1f6ce3428..d12bfc6f6bb1 100644 --- a/compiler/rustc_monomorphize/src/util.rs +++ b/compiler/rustc_monomorphize/src/util.rs @@ -29,12 +29,12 @@ pub(crate) fn dump_closure_profile<'tcx>(tcx: TyCtxt<'tcx>, closure_instance: In let before_feature_tys = tcx.subst_and_normalize_erasing_regions( closure_instance.substs, param_env, - before_feature_tys, + ty::EarlyBinder(before_feature_tys), ); let after_feature_tys = tcx.subst_and_normalize_erasing_regions( closure_instance.substs, param_env, - after_feature_tys, + ty::EarlyBinder(after_feature_tys), ); let new_size = tcx diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index b10aaad5f2af..ec577072e196 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -27,8 +27,7 @@ fn resolve_instance<'tcx>( ) } else { let ty = tcx.type_of(def); - let item_type = - tcx.subst_and_normalize_erasing_regions(substs, param_env, ty.skip_binder()); + let item_type = tcx.subst_and_normalize_erasing_regions(substs, param_env, ty); let def = match *item_type.kind() { ty::FnDef(def_id, ..) if tcx.is_intrinsic(def_id) => { 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 4c4c003ca469..87641c686dcf 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 @@ -435,7 +435,7 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty< let output_ty = fn_sig.output(); if output_ty.contains(*param_ty) { if let Ok(new_ty) = cx.tcx.try_subst_and_normalize_erasing_regions( - new_subst, cx.param_env, output_ty) { + new_subst, cx.param_env, EarlyBinder(output_ty)) { expr = parent_expr; ty = new_ty; continue; From 82f57c16b7f362c8f6509b9c334403d81a11beed Mon Sep 17 00:00:00 2001 From: Kyle Matsuda Date: Fri, 14 Apr 2023 09:59:03 -0600 Subject: [PATCH 46/97] use EarlyBinder in tcx.(try_)subst_mir_and_normalize_erasing_regions --- compiler/rustc_codegen_cranelift/src/common.rs | 2 +- compiler/rustc_codegen_ssa/src/mir/mod.rs | 2 +- .../rustc_const_eval/src/interpret/eval_context.rs | 6 +++++- compiler/rustc_middle/src/ty/instance.rs | 12 ++++++------ compiler/rustc_mir_transform/src/inline.rs | 2 +- compiler/rustc_mir_transform/src/inline/cycle.rs | 6 +++++- compiler/rustc_monomorphize/src/collector.rs | 2 +- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_codegen_cranelift/src/common.rs b/compiler/rustc_codegen_cranelift/src/common.rs index 264b95e7abd7..ccb3a0c4f27e 100644 --- a/compiler/rustc_codegen_cranelift/src/common.rs +++ b/compiler/rustc_codegen_cranelift/src/common.rs @@ -361,7 +361,7 @@ impl<'tcx> FunctionCx<'_, '_, 'tcx> { self.instance.subst_mir_and_normalize_erasing_regions( self.tcx, ty::ParamEnv::reveal_all(), - value, + ty::EarlyBinder(value), ) } diff --git a/compiler/rustc_codegen_ssa/src/mir/mod.rs b/compiler/rustc_codegen_ssa/src/mir/mod.rs index f706ecea9751..1204c99e533e 100644 --- a/compiler/rustc_codegen_ssa/src/mir/mod.rs +++ b/compiler/rustc_codegen_ssa/src/mir/mod.rs @@ -111,7 +111,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { self.instance.subst_mir_and_normalize_erasing_regions( self.cx.tcx(), ty::ParamEnv::reveal_all(), - value, + ty::EarlyBinder(value), ) } } diff --git a/compiler/rustc_const_eval/src/interpret/eval_context.rs b/compiler/rustc_const_eval/src/interpret/eval_context.rs index 361ce123c78e..b2197a0aabbf 100644 --- a/compiler/rustc_const_eval/src/interpret/eval_context.rs +++ b/compiler/rustc_const_eval/src/interpret/eval_context.rs @@ -495,7 +495,11 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { ) -> Result> { frame .instance - .try_subst_mir_and_normalize_erasing_regions(*self.tcx, self.param_env, value) + .try_subst_mir_and_normalize_erasing_regions( + *self.tcx, + self.param_env, + ty::EarlyBinder(value), + ) .map_err(|_| err_inval!(TooGeneric)) } diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index be584148595b..808f46bb2bb7 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -594,15 +594,15 @@ impl<'tcx> Instance<'tcx> { &self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, - v: T, + v: EarlyBinder, ) -> T where T: TypeFoldable> + Clone, { if let Some(substs) = self.substs_for_mir_body() { - tcx.subst_and_normalize_erasing_regions(substs, param_env, ty::EarlyBinder(v)) + tcx.subst_and_normalize_erasing_regions(substs, param_env, v) } else { - tcx.normalize_erasing_regions(param_env, v) + tcx.normalize_erasing_regions(param_env, v.subst_identity()) } } @@ -611,15 +611,15 @@ impl<'tcx> Instance<'tcx> { &self, tcx: TyCtxt<'tcx>, param_env: ty::ParamEnv<'tcx>, - v: T, + v: EarlyBinder, ) -> Result> where T: TypeFoldable> + Clone, { if let Some(substs) = self.substs_for_mir_body() { - tcx.try_subst_and_normalize_erasing_regions(substs, param_env, ty::EarlyBinder(v)) + tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v) } else { - tcx.try_normalize_erasing_regions(param_env, v) + tcx.try_normalize_erasing_regions(param_env, v.subst_identity()) } } diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 71bdfd5aae1f..95978946c4d9 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -180,7 +180,7 @@ impl<'tcx> Inliner<'tcx> { let Ok(callee_body) = callsite.callee.try_subst_mir_and_normalize_erasing_regions( self.tcx, self.param_env, - callee_body.clone(), + ty::EarlyBinder(callee_body.clone()), ) else { return Err("failed to normalize callee body"); }; diff --git a/compiler/rustc_mir_transform/src/inline/cycle.rs b/compiler/rustc_mir_transform/src/inline/cycle.rs index 6046c3876bee..1ccf06f6153f 100644 --- a/compiler/rustc_mir_transform/src/inline/cycle.rs +++ b/compiler/rustc_mir_transform/src/inline/cycle.rs @@ -44,7 +44,11 @@ pub(crate) fn mir_callgraph_reachable<'tcx>( ) -> bool { trace!(%caller); for &(callee, substs) in tcx.mir_inliner_callees(caller.def) { - let Ok(substs) = caller.try_subst_mir_and_normalize_erasing_regions(tcx, param_env, substs) else { + let Ok(substs) = caller.try_subst_mir_and_normalize_erasing_regions( + tcx, + param_env, + ty::EarlyBinder(substs), + ) else { trace!(?caller, ?param_env, ?substs, "cannot normalize, skipping"); continue; }; diff --git a/compiler/rustc_monomorphize/src/collector.rs b/compiler/rustc_monomorphize/src/collector.rs index 65162477b7bc..55c937b305a4 100644 --- a/compiler/rustc_monomorphize/src/collector.rs +++ b/compiler/rustc_monomorphize/src/collector.rs @@ -677,7 +677,7 @@ impl<'a, 'tcx> MirNeighborCollector<'a, 'tcx> { self.instance.subst_mir_and_normalize_erasing_regions( self.tcx, ty::ParamEnv::reveal_all(), - value, + ty::EarlyBinder(value), ) } } From e4f6b8b43b6e9c0373ee45aaa7a6f3094c475137 Mon Sep 17 00:00:00 2001 From: Kyle Matsuda Date: Fri, 14 Apr 2023 10:11:01 -0600 Subject: [PATCH 47/97] make subst_mir take EarlyBinder --- compiler/rustc_middle/src/ty/instance.rs | 7 ++++--- compiler/rustc_mir_transform/src/inline.rs | 10 +++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index 808f46bb2bb7..4bbd7aaf10f7 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -578,14 +578,15 @@ impl<'tcx> Instance<'tcx> { self.def.has_polymorphic_mir_body().then_some(self.substs) } - pub fn subst_mir(&self, tcx: TyCtxt<'tcx>, v: &T) -> T + pub fn subst_mir(&self, tcx: TyCtxt<'tcx>, v: EarlyBinder<&T>) -> T where T: TypeFoldable> + Copy, { + let v = v.map_bound(|v| *v); if let Some(substs) = self.substs_for_mir_body() { - EarlyBinder(*v).subst(tcx, substs) + v.subst(tcx, substs) } else { - *v + v.subst_identity() } } diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 95978946c4d9..ece20d8d3e6e 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -444,7 +444,9 @@ impl<'tcx> Inliner<'tcx> { work_list.push(target); // If the place doesn't actually need dropping, treat it like a regular goto. - let ty = callsite.callee.subst_mir(self.tcx, &place.ty(callee_body, tcx).ty); + let ty = callsite + .callee + .subst_mir(self.tcx, ty::EarlyBinder(&place.ty(callee_body, tcx).ty)); if ty.needs_drop(tcx, self.param_env) && let UnwindAction::Cleanup(unwind) = unwind { work_list.push(unwind); } @@ -788,7 +790,9 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> { match terminator.kind { TerminatorKind::Drop { ref place, unwind, .. } => { // If the place doesn't actually need dropping, treat it like a regular goto. - let ty = self.instance.subst_mir(tcx, &place.ty(self.callee_body, tcx).ty); + let ty = self + .instance + .subst_mir(tcx, ty::EarlyBinder(&place.ty(self.callee_body, tcx).ty)); if ty.needs_drop(tcx, self.param_env) { self.cost += CALL_PENALTY; if let UnwindAction::Cleanup(_) = unwind { @@ -799,7 +803,7 @@ impl<'tcx> Visitor<'tcx> for CostChecker<'_, 'tcx> { } } TerminatorKind::Call { func: Operand::Constant(ref f), unwind, .. } => { - let fn_ty = self.instance.subst_mir(tcx, &f.literal.ty()); + let fn_ty = self.instance.subst_mir(tcx, ty::EarlyBinder(&f.literal.ty())); self.cost += if let ty::FnDef(def_id, _) = *fn_ty.kind() && tcx.is_intrinsic(def_id) { // Don't give intrinsics the extra penalty for calls INSTR_COST From d27f40175fb7221bc5fa4c19ff75e211947222e8 Mon Sep 17 00:00:00 2001 From: Kyle Matsuda Date: Sat, 6 May 2023 22:56:51 -0600 Subject: [PATCH 48/97] changes from review: add FIXME to clippy and change subst_identity to skip_binder in mir subst methods --- compiler/rustc_middle/src/ty/instance.rs | 6 +++--- .../clippy/clippy_lints/src/methods/unnecessary_to_owned.rs | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/compiler/rustc_middle/src/ty/instance.rs b/compiler/rustc_middle/src/ty/instance.rs index 4bbd7aaf10f7..8c69894f5ba7 100644 --- a/compiler/rustc_middle/src/ty/instance.rs +++ b/compiler/rustc_middle/src/ty/instance.rs @@ -586,7 +586,7 @@ impl<'tcx> Instance<'tcx> { if let Some(substs) = self.substs_for_mir_body() { v.subst(tcx, substs) } else { - v.subst_identity() + v.skip_binder() } } @@ -603,7 +603,7 @@ impl<'tcx> Instance<'tcx> { if let Some(substs) = self.substs_for_mir_body() { tcx.subst_and_normalize_erasing_regions(substs, param_env, v) } else { - tcx.normalize_erasing_regions(param_env, v.subst_identity()) + tcx.normalize_erasing_regions(param_env, v.skip_binder()) } } @@ -620,7 +620,7 @@ impl<'tcx> Instance<'tcx> { if let Some(substs) = self.substs_for_mir_body() { tcx.try_subst_and_normalize_erasing_regions(substs, param_env, v) } else { - tcx.try_normalize_erasing_regions(param_env, v.subst_identity()) + tcx.try_normalize_erasing_regions(param_env, v.skip_binder()) } } 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 87641c686dcf..67b7d3691dc0 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 @@ -385,6 +385,9 @@ fn can_change_type<'a>(cx: &LateContext<'a>, mut expr: &'a Expr<'a>, mut ty: Ty< Node::Expr(parent_expr) => { if let Some((callee_def_id, call_substs, recv, call_args)) = get_callee_substs_and_args(cx, parent_expr) { + // FIXME: the `subst_identity()` below seems incorrect, since we eventually + // call `tcx.try_subst_and_normalize_erasing_regions` further down + // (i.e., we are explicitly not in the identity context). let fn_sig = cx.tcx.fn_sig(callee_def_id).subst_identity().skip_binder(); if let Some(arg_index) = recv.into_iter().chain(call_args).position(|arg| arg.hir_id == expr.hir_id) && let Some(param_ty) = fn_sig.inputs().get(arg_index) From 48dfbeee27e748a598681d24bd8b69f5ea611f85 Mon Sep 17 00:00:00 2001 From: Arpad Borsos Date: Sun, 7 May 2023 10:52:01 +0200 Subject: [PATCH 49/97] Remove `identity_future` from stdlib This function/lang_item was introduced in #104321 as a temporary workaround of future lowering. The usage and need for it went away in #104833. After a bootstrap update, the function itself can be removed from `std`. --- library/core/src/future/mod.rs | 7 ------- src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs | 1 - 2 files changed, 8 deletions(-) diff --git a/library/core/src/future/mod.rs b/library/core/src/future/mod.rs index 7a8d0cacdece..089493d3766d 100644 --- a/library/core/src/future/mod.rs +++ b/library/core/src/future/mod.rs @@ -66,10 +66,3 @@ pub unsafe fn get_context<'a, 'b>(cx: ResumeTy) -> &'a mut Context<'b> { // that fulfills all the requirements for a mutable reference. unsafe { &mut *cx.0.as_ptr().cast() } } - -#[doc(hidden)] -#[unstable(feature = "gen_future", issue = "50547")] -#[inline] -pub const fn identity_future>(f: Fut) -> Fut { - f -} diff --git a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs index 4096e0a38267..d338bb412054 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/lang_item.rs @@ -379,7 +379,6 @@ language_item_table! { // FIXME(swatinem): the following lang items are used for async lowering and // should become obsolete eventually. ResumeTy, ResumeTy, resume_ty, Target::Struct, GenericRequirement::None; - IdentityFuture, identity_future, identity_future_fn, Target::Fn, GenericRequirement::None; GetContext, get_context, get_context_fn, Target::Fn, GenericRequirement::None; Context, Context, context, Target::Struct, GenericRequirement::None; From a8988519d508cf89b96d18aaa9ace4e0bcd67621 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 25 Apr 2023 19:25:28 +0000 Subject: [PATCH 50/97] Propagate PlaceElem::Index. --- compiler/rustc_mir_transform/src/const_prop.rs | 18 ++++++++++++++++++ ...fe_oob_for_slices.main.ConstProp.32bit.diff | 3 ++- ...fe_oob_for_slices.main.ConstProp.64bit.diff | 3 ++- ...large_array_index.main.ConstProp.32bit.diff | 3 ++- ...large_array_index.main.ConstProp.64bit.diff | 3 ++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_mir_transform/src/const_prop.rs b/compiler/rustc_mir_transform/src/const_prop.rs index 7f995c69a487..a5d18fff89bd 100644 --- a/compiler/rustc_mir_transform/src/const_prop.rs +++ b/compiler/rustc_mir_transform/src/const_prop.rs @@ -806,6 +806,24 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> { } } + fn process_projection_elem( + &mut self, + elem: PlaceElem<'tcx>, + _: Location, + ) -> Option> { + if let PlaceElem::Index(local) = elem + && let Some(value) = self.get_const(local.into()) + && self.should_const_prop(&value) + && let interpret::Operand::Immediate(interpret::Immediate::Scalar(scalar)) = *value + && let Ok(offset) = scalar.to_target_usize(&self.tcx) + && let Some(min_length) = offset.checked_add(1) + { + Some(PlaceElem::ConstantIndex { offset, min_length, from_end: false }) + } else { + None + } + } + fn visit_assign( &mut self, place: &mut Place<'tcx>, diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff index f63ee705d92a..d72675c2d115 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.diff @@ -45,7 +45,8 @@ } bb1: { - _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 diff --git a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff index f63ee705d92a..d72675c2d115 100644 --- a/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.diff @@ -45,7 +45,8 @@ } bb1: { - _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 +- _5 = (*_1)[_6]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 ++ _5 = (*_1)[3 of 4]; // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:18: +3:25 StorageDead(_6); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+3:25: +3:26 _0 = const (); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+2:5: +4:6 StorageDead(_5); // scope 2 at $DIR/bad_op_unsafe_oob_for_slices.rs:+4:5: +4:6 diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff index 36336d967a9d..33bbad2f422b 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.diff @@ -27,7 +27,8 @@ } bb1: { - _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2 diff --git a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff index 36336d967a9d..33bbad2f422b 100644 --- a/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff +++ b/tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.diff @@ -27,7 +27,8 @@ } bb1: { - _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 +- _1 = _2[_3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 ++ _1 = _2[2 of 3]; // scope 0 at $DIR/large_array_index.rs:+2:17: +2:32 StorageDead(_3); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 StorageDead(_2); // scope 0 at $DIR/large_array_index.rs:+2:32: +2:33 _0 = const (); // scope 0 at $DIR/large_array_index.rs:+0:11: +3:2 From 47171e0c500e791280e269a73c382bfac15148b2 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Sun, 6 Nov 2022 21:24:20 +0000 Subject: [PATCH 51/97] Use `landingpad filter` to encode aborting landing pad --- compiler/rustc_codegen_gcc/src/builder.rs | 4 ++++ compiler/rustc_codegen_llvm/src/builder.rs | 7 +++++++ compiler/rustc_codegen_ssa/src/mir/block.rs | 2 +- compiler/rustc_codegen_ssa/src/traits/builder.rs | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index a66ddb6a09f2..5fba09d795ce 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -1227,6 +1227,10 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { (value1, value2) } + fn filter_landing_pad(&mut self, pers_fn: RValue<'gcc>) -> (RValue<'gcc>, RValue<'gcc>) { + self.cleanup_landing_pad(pers_fn) + } + #[cfg(feature="master")] fn resume(&mut self, exn0: RValue<'gcc>, _exn1: RValue<'gcc>) { let exn_type = exn0.get_type(); diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index 2fd6db8cbfea..10da8cc4c255 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -992,6 +992,13 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { (self.extract_value(landing_pad, 0), self.extract_value(landing_pad, 1)) } + fn filter_landing_pad(&mut self, pers_fn: &'ll Value) -> (&'ll Value, &'ll Value) { + let ty = self.type_struct(&[self.type_i8p(), self.type_i32()], false); + let landing_pad = self.landing_pad(ty, pers_fn, 1 /* FIXME should this be 0? */); + self.add_clause(landing_pad, self.const_array(self.type_i8p(), &[])); + (self.extract_value(landing_pad, 0), self.extract_value(landing_pad, 1)) + } + fn resume(&mut self, exn0: &'ll Value, exn1: &'ll Value) { let ty = self.type_struct(&[self.type_i8p(), self.type_i32()], false); let mut exn = self.const_poison(ty); diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs index c1613a9640a8..a832999225ab 100644 --- a/compiler/rustc_codegen_ssa/src/mir/block.rs +++ b/compiler/rustc_codegen_ssa/src/mir/block.rs @@ -1600,7 +1600,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { bx = Bx::build(self.cx, llbb); let llpersonality = self.cx.eh_personality(); - bx.cleanup_landing_pad(llpersonality); + bx.filter_landing_pad(llpersonality); funclet = None; } diff --git a/compiler/rustc_codegen_ssa/src/traits/builder.rs b/compiler/rustc_codegen_ssa/src/traits/builder.rs index 57de7e9620e8..853c6934c2c2 100644 --- a/compiler/rustc_codegen_ssa/src/traits/builder.rs +++ b/compiler/rustc_codegen_ssa/src/traits/builder.rs @@ -274,6 +274,7 @@ pub trait BuilderMethods<'a, 'tcx>: // These are used by everyone except msvc fn cleanup_landing_pad(&mut self, pers_fn: Self::Value) -> (Self::Value, Self::Value); + fn filter_landing_pad(&mut self, pers_fn: Self::Value) -> (Self::Value, Self::Value); fn resume(&mut self, exn0: Self::Value, exn1: Self::Value); // These are used only by msvc From 62237536da0e17fdaa5c03965563a200296c6e12 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Sun, 6 Nov 2022 21:32:55 +0000 Subject: [PATCH 52/97] Parse catch filter in personality function --- library/std/src/personality/dwarf/eh.rs | 5 ++++- library/std/src/personality/gcc.rs | 8 ++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/library/std/src/personality/dwarf/eh.rs b/library/std/src/personality/dwarf/eh.rs index 87585a8fcd0d..79624703a4cf 100644 --- a/library/std/src/personality/dwarf/eh.rs +++ b/library/std/src/personality/dwarf/eh.rs @@ -47,6 +47,7 @@ pub enum EHAction { None, Cleanup(usize), Catch(usize), + Filter(usize), Terminate, } @@ -142,9 +143,11 @@ unsafe fn interpret_cs_action( let ttype_index = action_reader.read_sleb128(); if ttype_index == 0 { EHAction::Cleanup(lpad) - } else { + } else if ttype_index > 0 { // Stop unwinding Rust panics at catch_unwind. EHAction::Catch(lpad) + } else { + EHAction::Filter(lpad) } } } diff --git a/library/std/src/personality/gcc.rs b/library/std/src/personality/gcc.rs index 0421b47be024..4c29c332b75a 100644 --- a/library/std/src/personality/gcc.rs +++ b/library/std/src/personality/gcc.rs @@ -135,7 +135,7 @@ cfg_if::cfg_if! { EHAction::None | EHAction::Cleanup(_) => { return continue_unwind(exception_object, context); } - EHAction::Catch(_) => { + EHAction::Catch(_) | EHAction::Filter(_) => { // EHABI requires the personality routine to update the // SP value in the barrier cache of the exception object. (*exception_object).private[5] = @@ -147,7 +147,7 @@ cfg_if::cfg_if! { } else { match eh_action { EHAction::None => return continue_unwind(exception_object, context), - EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => { + EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => { uw::_Unwind_SetGR( context, UNWIND_DATA_REG.0, @@ -201,13 +201,13 @@ cfg_if::cfg_if! { if actions as i32 & uw::_UA_SEARCH_PHASE as i32 != 0 { match eh_action { EHAction::None | EHAction::Cleanup(_) => uw::_URC_CONTINUE_UNWIND, - EHAction::Catch(_) => uw::_URC_HANDLER_FOUND, + EHAction::Catch(_) | EHAction::Filter(_) => uw::_URC_HANDLER_FOUND, EHAction::Terminate => uw::_URC_FATAL_PHASE1_ERROR, } } else { match eh_action { EHAction::None => uw::_URC_CONTINUE_UNWIND, - EHAction::Cleanup(lpad) | EHAction::Catch(lpad) => { + EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => { uw::_Unwind_SetGR( context, UNWIND_DATA_REG.0, From 37f7d322b8cd9e9712c3cc9cf3a550371bd164e0 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Sun, 6 Nov 2022 21:35:10 +0000 Subject: [PATCH 53/97] Prevent aborting guard from aborting the process in a forced unwind --- library/std/src/personality/gcc.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/library/std/src/personality/gcc.rs b/library/std/src/personality/gcc.rs index 4c29c332b75a..82edb11cbd14 100644 --- a/library/std/src/personality/gcc.rs +++ b/library/std/src/personality/gcc.rs @@ -147,6 +147,7 @@ cfg_if::cfg_if! { } else { match eh_action { EHAction::None => return continue_unwind(exception_object, context), + EHAction::Filter(_) if state & uw::_US_FORCE_UNWIND as c_int != 0 => return continue_unwind(exception_object, context), EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => { uw::_Unwind_SetGR( context, @@ -207,6 +208,8 @@ cfg_if::cfg_if! { } else { match eh_action { EHAction::None => uw::_URC_CONTINUE_UNWIND, + // Forced unwinding hits a terminate action. + EHAction::Filter(_) if actions as i32 & uw::_UA_FORCE_UNWIND as i32 != 0 => uw::_URC_CONTINUE_UNWIND, EHAction::Cleanup(lpad) | EHAction::Catch(lpad) | EHAction::Filter(lpad) => { uw::_Unwind_SetGR( context, From ecd04fd1b553c06e3e48c0f8485de46758e51636 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Fri, 7 Apr 2023 17:15:41 +0100 Subject: [PATCH 54/97] Add test for unwinding past terminating POF --- .../forced-unwind-terminate-pof/Makefile | 9 +++++++++ .../run-make/forced-unwind-terminate-pof/foo.rs | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 tests/run-make/forced-unwind-terminate-pof/Makefile create mode 100644 tests/run-make/forced-unwind-terminate-pof/foo.rs diff --git a/tests/run-make/forced-unwind-terminate-pof/Makefile b/tests/run-make/forced-unwind-terminate-pof/Makefile new file mode 100644 index 000000000000..871621520b91 --- /dev/null +++ b/tests/run-make/forced-unwind-terminate-pof/Makefile @@ -0,0 +1,9 @@ +# ignore-cross-compile +# only-linux +include ../tools.mk + +all: foo + $(call RUN,foo) | $(CGREP) -v "cannot unwind" + +foo: foo.rs + $(RUSTC) $< diff --git a/tests/run-make/forced-unwind-terminate-pof/foo.rs b/tests/run-make/forced-unwind-terminate-pof/foo.rs new file mode 100644 index 000000000000..0a51287313f6 --- /dev/null +++ b/tests/run-make/forced-unwind-terminate-pof/foo.rs @@ -0,0 +1,17 @@ +// Tests that forced unwind through POF Rust frames wouldn't trigger our terminating guards. + +#![feature(c_unwind)] +#![no_main] + +extern "C-unwind" { + fn pthread_exit(v: *mut core::ffi::c_void) -> !; +} + +unsafe extern "C" fn call_pthread_exit() { + pthread_exit(core::ptr::null_mut()); +} + +#[no_mangle] +unsafe extern "C-unwind" fn main(_argc: core::ffi::c_int, _argv: *mut *mut core::ffi::c_char) { + call_pthread_exit(); +} From 97926360e755547dc4663ab75af1e37e9a68e58b Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Fri, 7 Apr 2023 20:11:19 +0100 Subject: [PATCH 55/97] Fix num reserved clauses for landing pad --- compiler/rustc_codegen_llvm/src/builder.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_llvm/src/builder.rs b/compiler/rustc_codegen_llvm/src/builder.rs index 10da8cc4c255..4d0bcd53d156 100644 --- a/compiler/rustc_codegen_llvm/src/builder.rs +++ b/compiler/rustc_codegen_llvm/src/builder.rs @@ -985,7 +985,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { fn cleanup_landing_pad(&mut self, pers_fn: &'ll Value) -> (&'ll Value, &'ll Value) { let ty = self.type_struct(&[self.type_i8p(), self.type_i32()], false); - let landing_pad = self.landing_pad(ty, pers_fn, 1 /* FIXME should this be 0? */); + let landing_pad = self.landing_pad(ty, pers_fn, 0); unsafe { llvm::LLVMSetCleanup(landing_pad, llvm::True); } @@ -994,7 +994,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> { fn filter_landing_pad(&mut self, pers_fn: &'ll Value) -> (&'ll Value, &'ll Value) { let ty = self.type_struct(&[self.type_i8p(), self.type_i32()], false); - let landing_pad = self.landing_pad(ty, pers_fn, 1 /* FIXME should this be 0? */); + let landing_pad = self.landing_pad(ty, pers_fn, 1); self.add_clause(landing_pad, self.const_array(self.type_i8p(), &[])); (self.extract_value(landing_pad, 0), self.extract_value(landing_pad, 1)) } From 91afde57a28b1619f140fbe8463d150ce7c8adca Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Sat, 8 Apr 2023 13:12:24 +0100 Subject: [PATCH 56/97] Add todo for filter landing pad --- compiler/rustc_codegen_gcc/src/builder.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index 5fba09d795ce..869344ce92d7 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -1228,6 +1228,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { } fn filter_landing_pad(&mut self, pers_fn: RValue<'gcc>) -> (RValue<'gcc>, RValue<'gcc>) { + // TODO(antoyo): generate the correct landing pad self.cleanup_landing_pad(pers_fn) } From 16abe6c83d2c9eba8f54be8fbe25ed49791e1e45 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Sun, 9 Apr 2023 12:05:35 +0100 Subject: [PATCH 57/97] Fix codegen test --- tests/codegen/vec-shrink-panik.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/codegen/vec-shrink-panik.rs b/tests/codegen/vec-shrink-panik.rs index b3c3483fea98..4e5d8dc06324 100644 --- a/tests/codegen/vec-shrink-panik.rs +++ b/tests/codegen/vec-shrink-panik.rs @@ -25,7 +25,7 @@ pub fn issue71861(vec: Vec) -> Box<[u32]> { // Call to panic_cannot_unwind in case of double-panic is expected // on LLVM 16 and older, but other panics are not. - // CHECK: cleanup + // CHECK: filter // old-NEXT: ; call core::panicking::panic_cannot_unwind // old-NEXT: panic_cannot_unwind @@ -40,7 +40,7 @@ pub fn issue75636<'a>(iter: &[&'a str]) -> Box<[&'a str]> { // Call to panic_cannot_unwind in case of double-panic is expected, // on LLVM 16 and older, but other panics are not. - // CHECK: cleanup + // CHECK: filter // old-NEXT: ; call core::panicking::panic_cannot_unwind // old-NEXT: panic_cannot_unwind From 8bafcdeac3918035a9df68b025ac31cc176f8ef8 Mon Sep 17 00:00:00 2001 From: Gary Guo Date: Thu, 6 Apr 2023 23:42:38 +0100 Subject: [PATCH 58/97] Add `#[inline]` to functions that are never called --- library/core/src/cmp.rs | 3 +++ library/core/src/convert/mod.rs | 1 + library/core/src/fmt/mod.rs | 2 ++ library/core/src/intrinsics.rs | 1 + library/core/src/intrinsics/mir.rs | 1 + library/core/src/num/error.rs | 1 + 6 files changed, 9 insertions(+) diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index 48b127716f50..faf48ae570fd 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -1412,6 +1412,7 @@ mod impls { #[unstable(feature = "never_type", issue = "35121")] impl PartialEq for ! { + #[inline] fn eq(&self, _: &!) -> bool { *self } @@ -1422,6 +1423,7 @@ mod impls { #[unstable(feature = "never_type", issue = "35121")] impl PartialOrd for ! { + #[inline] fn partial_cmp(&self, _: &!) -> Option { *self } @@ -1429,6 +1431,7 @@ mod impls { #[unstable(feature = "never_type", issue = "35121")] impl Ord for ! { + #[inline] fn cmp(&self, _: &!) -> Ordering { *self } diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 3ae787cac71f..38a6d1ccdb55 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -915,6 +915,7 @@ impl Ord for Infallible { #[stable(feature = "convert_infallible", since = "1.34.0")] impl From for Infallible { + #[inline] fn from(x: !) -> Self { x } diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index e193332f155b..7db9f40dd986 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -2269,6 +2269,7 @@ fmt_refs! { Debug, Display, Octal, Binary, LowerHex, UpperHex, LowerExp, UpperEx #[unstable(feature = "never_type", issue = "35121")] impl Debug for ! { + #[inline] fn fmt(&self, _: &mut Formatter<'_>) -> Result { *self } @@ -2276,6 +2277,7 @@ impl Debug for ! { #[unstable(feature = "never_type", issue = "35121")] impl Display for ! { + #[inline] fn fmt(&self, _: &mut Formatter<'_>) -> Result { *self } diff --git a/library/core/src/intrinsics.rs b/library/core/src/intrinsics.rs index 077c0fdc380b..3f2b1595d62b 100644 --- a/library/core/src/intrinsics.rs +++ b/library/core/src/intrinsics.rs @@ -2523,6 +2523,7 @@ macro_rules! assert_unsafe_precondition { } } #[allow(non_snake_case)] + #[inline] const fn comptime$(<$($tt)*>)?($(_:$ty),*) {} ::core::intrinsics::const_eval_select(($($i,)*), comptime, runtime); diff --git a/library/core/src/intrinsics/mir.rs b/library/core/src/intrinsics/mir.rs index 45498a54b25d..b95c01b0af7b 100644 --- a/library/core/src/intrinsics/mir.rs +++ b/library/core/src/intrinsics/mir.rs @@ -265,6 +265,7 @@ pub struct BasicBlock; macro_rules! define { ($name:literal, $( #[ $meta:meta ] )* fn $($sig:tt)*) => { #[rustc_diagnostic_item = $name] + #[inline] $( #[ $meta ] )* pub fn $($sig)* { panic!() } } diff --git a/library/core/src/num/error.rs b/library/core/src/num/error.rs index 2ad0f1dc5063..14e99578a7c7 100644 --- a/library/core/src/num/error.rs +++ b/library/core/src/num/error.rs @@ -34,6 +34,7 @@ impl From for TryFromIntError { #[unstable(feature = "never_type", issue = "35121")] impl From for TryFromIntError { + #[inline] fn from(never: !) -> TryFromIntError { // Match rather than coerce to make sure that code like // `From for TryFromIntError` above will keep working From 3ba3df376416eb821e2fe9e3e93243df96e3eaa9 Mon Sep 17 00:00:00 2001 From: Nikolay Arhipov Date: Sun, 7 May 2023 11:20:01 +0300 Subject: [PATCH 59/97] PS Vita std support --- Cargo.lock | 4 +- .../src/spec/armv7_sony_vita_newlibeabihf.rs | 2 +- library/backtrace | 2 +- library/std/Cargo.toml | 2 +- library/std/build.rs | 1 + library/std/src/os/mod.rs | 2 + library/std/src/os/unix/mod.rs | 2 + library/std/src/os/vita/fs.rs | 95 ++++++++++++++++++ library/std/src/os/vita/mod.rs | 6 ++ library/std/src/os/vita/raw.rs | 70 +++++++++++++ library/std/src/sys/unix/alloc.rs | 3 +- library/std/src/sys/unix/args.rs | 2 +- library/std/src/sys/unix/env.rs | 11 +++ library/std/src/sys/unix/fd.rs | 13 +-- library/std/src/sys/unix/fs.rs | 19 +++- library/std/src/sys/unix/mod.rs | 17 +++- library/std/src/sys/unix/os.rs | 8 +- library/std/src/sys/unix/process/mod.rs | 2 +- library/std/src/sys/unix/rand.rs | 5 +- ...ihf.md => armv7-sony-vita-newlibeabihf.md} | 97 ++++++++++++++++--- 20 files changed, 322 insertions(+), 41 deletions(-) create mode 100644 library/std/src/os/vita/fs.rs create mode 100644 library/std/src/os/vita/mod.rs create mode 100644 library/std/src/os/vita/raw.rs rename src/doc/rustc/src/platform-support/{armv7-sony-vita-eabihf.md => armv7-sony-vita-newlibeabihf.md} (54%) diff --git a/Cargo.lock b/Cargo.lock index 724587a4a71c..67392f1b3a99 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1938,9 +1938,9 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "libc" -version = "0.2.142" +version = "0.2.143" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" +checksum = "edc207893e85c5d6be840e969b496b53d94cec8be2d501b214f50daa97fa8024" dependencies = [ "rustc-std-workspace-core", ] diff --git a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs index ebd2cca25ea9..0fd59cbd4832 100644 --- a/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs +++ b/compiler/rustc_target/src/spec/armv7_sony_vita_newlibeabihf.rs @@ -9,7 +9,7 @@ pub fn target() -> Target { let pre_link_args = TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &["-Wl,-q"]); Target { - llvm_target: "armv7a-vita-newlibeabihf".into(), + llvm_target: "armv7a-vita-eabihf".into(), pointer_width: 32, data_layout: "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64".into(), arch: "arm".into(), diff --git a/library/backtrace b/library/backtrace index 8ad84ca5ad88..4245978ca816 160000 --- a/library/backtrace +++ b/library/backtrace @@ -1 +1 @@ -Subproject commit 8ad84ca5ad88ade697637387e7cb4d7c3cf4bde8 +Subproject commit 4245978ca8169c40c088ff733825e4527f7b914c diff --git a/library/std/Cargo.toml b/library/std/Cargo.toml index 72a5b4773306..77a0426f233b 100644 --- a/library/std/Cargo.toml +++ b/library/std/Cargo.toml @@ -15,7 +15,7 @@ cfg-if = { version = "1.0", features = ['rustc-dep-of-std'] } panic_unwind = { path = "../panic_unwind", optional = true } panic_abort = { path = "../panic_abort" } core = { path = "../core" } -libc = { version = "0.2.142", default-features = false, features = ['rustc-dep-of-std'] } +libc = { version = "0.2.143", default-features = false, features = ['rustc-dep-of-std'] } compiler_builtins = { version = "0.1.91" } profiler_builtins = { path = "../profiler_builtins", optional = true } unwind = { path = "../unwind" } diff --git a/library/std/build.rs b/library/std/build.rs index cf708db6f27e..0fb03c8e88af 100644 --- a/library/std/build.rs +++ b/library/std/build.rs @@ -34,6 +34,7 @@ fn main() { || target.contains("espidf") || target.contains("solid") || target.contains("nintendo-3ds") + || target.contains("vita") || target.contains("nto") { // These platforms don't have any special requirements. diff --git a/library/std/src/os/mod.rs b/library/std/src/os/mod.rs index b148d8a00918..5b54cc5f2e49 100644 --- a/library/std/src/os/mod.rs +++ b/library/std/src/os/mod.rs @@ -137,6 +137,8 @@ pub mod redox; pub mod solaris; #[cfg(target_os = "solid_asp3")] pub mod solid; +#[cfg(target_os = "vita")] +pub mod vita; #[cfg(target_os = "vxworks")] pub mod vxworks; #[cfg(target_os = "watchos")] diff --git a/library/std/src/os/unix/mod.rs b/library/std/src/os/unix/mod.rs index eb2d7ce11747..6fe1111188aa 100644 --- a/library/std/src/os/unix/mod.rs +++ b/library/std/src/os/unix/mod.rs @@ -73,6 +73,8 @@ mod platform { pub use crate::os::redox::*; #[cfg(target_os = "solaris")] pub use crate::os::solaris::*; + #[cfg(target_os = "vita")] + pub use crate::os::vita::*; #[cfg(target_os = "vxworks")] pub use crate::os::vxworks::*; #[cfg(target_os = "watchos")] diff --git a/library/std/src/os/vita/fs.rs b/library/std/src/os/vita/fs.rs new file mode 100644 index 000000000000..a5a06764a4dd --- /dev/null +++ b/library/std/src/os/vita/fs.rs @@ -0,0 +1,95 @@ +#![stable(feature = "metadata_ext", since = "1.1.0")] + +use crate::fs::Metadata; +use crate::sys_common::AsInner; + +/// OS-specific extensions to [`fs::Metadata`]. +/// +/// [`fs::Metadata`]: crate::fs::Metadata +#[stable(feature = "metadata_ext", since = "1.1.0")] +pub trait MetadataExt { + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_dev(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ino(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mode(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_nlink(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_uid(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_gid(&self) -> u32; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_rdev(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_size(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_atime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_atime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mtime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_mtime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ctime(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_ctime_nsec(&self) -> i64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_blksize(&self) -> u64; + #[stable(feature = "metadata_ext2", since = "1.8.0")] + fn st_blocks(&self) -> u64; +} + +#[stable(feature = "metadata_ext", since = "1.1.0")] +impl MetadataExt for Metadata { + fn st_dev(&self) -> u64 { + self.as_inner().as_inner().st_dev as u64 + } + fn st_ino(&self) -> u64 { + self.as_inner().as_inner().st_ino as u64 + } + fn st_mode(&self) -> u32 { + self.as_inner().as_inner().st_mode as u32 + } + fn st_nlink(&self) -> u64 { + self.as_inner().as_inner().st_nlink as u64 + } + fn st_uid(&self) -> u32 { + self.as_inner().as_inner().st_uid as u32 + } + fn st_gid(&self) -> u32 { + self.as_inner().as_inner().st_gid as u32 + } + fn st_rdev(&self) -> u64 { + self.as_inner().as_inner().st_rdev as u64 + } + fn st_size(&self) -> u64 { + self.as_inner().as_inner().st_size as u64 + } + fn st_atime(&self) -> i64 { + self.as_inner().as_inner().st_atime as i64 + } + fn st_atime_nsec(&self) -> i64 { + 0 + } + fn st_mtime(&self) -> i64 { + self.as_inner().as_inner().st_mtime as i64 + } + fn st_mtime_nsec(&self) -> i64 { + 0 + } + fn st_ctime(&self) -> i64 { + self.as_inner().as_inner().st_ctime as i64 + } + fn st_ctime_nsec(&self) -> i64 { + 0 + } + fn st_blksize(&self) -> u64 { + self.as_inner().as_inner().st_blksize as u64 + } + fn st_blocks(&self) -> u64 { + self.as_inner().as_inner().st_blocks as u64 + } +} diff --git a/library/std/src/os/vita/mod.rs b/library/std/src/os/vita/mod.rs new file mode 100644 index 000000000000..da9edd12f7b0 --- /dev/null +++ b/library/std/src/os/vita/mod.rs @@ -0,0 +1,6 @@ +//! Definitions for vita + +#![stable(feature = "raw_ext", since = "1.1.0")] + +pub mod fs; +pub(crate) mod raw; diff --git a/library/std/src/os/vita/raw.rs b/library/std/src/os/vita/raw.rs new file mode 100644 index 000000000000..74cae4d4135d --- /dev/null +++ b/library/std/src/os/vita/raw.rs @@ -0,0 +1,70 @@ +//! vita raw type definitions + +#![stable(feature = "raw_ext", since = "1.1.0")] +#![deprecated( + since = "1.8.0", + note = "these type aliases are no longer supported by \ + the standard library, the `libc` crate on \ + crates.io should be used instead for the correct \ + definitions" +)] +#![allow(deprecated)] + +use crate::os::raw::c_long; +use crate::os::unix::raw::{gid_t, uid_t}; + +#[stable(feature = "pthread_t", since = "1.8.0")] +pub type pthread_t = libc::pthread_t; + +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type blkcnt_t = libc::blkcnt_t; + +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type blksize_t = libc::blksize_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type dev_t = libc::dev_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type ino_t = libc::ino_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type mode_t = libc::mode_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type nlink_t = libc::nlink_t; +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type off_t = libc::off_t; + +#[stable(feature = "raw_ext", since = "1.1.0")] +pub type time_t = libc::time_t; + +#[repr(C)] +#[derive(Clone)] +#[stable(feature = "raw_ext", since = "1.1.0")] +pub struct stat { + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_dev: dev_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ino: ino_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mode: mode_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_nlink: nlink_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_uid: uid_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_gid: gid_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_rdev: dev_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_size: off_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_atime: time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_mtime: time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_ctime: time_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_blksize: blksize_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_blocks: blkcnt_t, + #[stable(feature = "raw_ext", since = "1.1.0")] + pub st_spare4: [c_long; 2usize], +} diff --git a/library/std/src/sys/unix/alloc.rs b/library/std/src/sys/unix/alloc.rs index 9d6567c9fb47..8604b53983d6 100644 --- a/library/std/src/sys/unix/alloc.rs +++ b/library/std/src/sys/unix/alloc.rs @@ -59,7 +59,8 @@ cfg_if::cfg_if! { target_os = "redox", target_os = "solaris", target_os = "espidf", - target_os = "horizon" + target_os = "horizon", + target_os = "vita", ))] { #[inline] unsafe fn aligned_malloc(layout: &Layout) -> *mut u8 { diff --git a/library/std/src/sys/unix/args.rs b/library/std/src/sys/unix/args.rs index 3d79058b320c..9ed4d9c1e0dd 100644 --- a/library/std/src/sys/unix/args.rs +++ b/library/std/src/sys/unix/args.rs @@ -265,7 +265,7 @@ mod imp { } } -#[cfg(target_os = "espidf")] +#[cfg(any(target_os = "espidf", target_os = "vita"))] mod imp { use super::Args; diff --git a/library/std/src/sys/unix/env.rs b/library/std/src/sys/unix/env.rs index 1a9276f11100..8c3ef88d8f8e 100644 --- a/library/std/src/sys/unix/env.rs +++ b/library/std/src/sys/unix/env.rs @@ -141,6 +141,17 @@ pub mod os { pub const EXE_EXTENSION: &str = "elf"; } +#[cfg(target_os = "vita")] +pub mod os { + pub const FAMILY: &str = "unix"; + pub const OS: &str = "vita"; + pub const DLL_PREFIX: &str = "lib"; + pub const DLL_SUFFIX: &str = ".so"; + pub const DLL_EXTENSION: &str = "so"; + pub const EXE_SUFFIX: &str = ".elf"; + pub const EXE_EXTENSION: &str = "elf"; +} + #[cfg(all(target_os = "emscripten", target_arch = "asmjs"))] pub mod os { pub const FAMILY: &str = "unix"; diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs index 45f96478fc37..cb630eede6da 100644 --- a/library/std/src/sys/unix/fd.rs +++ b/library/std/src/sys/unix/fd.rs @@ -75,6 +75,7 @@ const fn max_iov() -> usize { target_os = "nto", target_os = "openbsd", target_os = "horizon", + target_os = "vita", target_os = "watchos", )))] const fn max_iov() -> usize { @@ -93,7 +94,7 @@ impl FileDesc { Ok(ret as usize) } - #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))] pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result { let ret = cvt(unsafe { libc::readv( @@ -105,14 +106,14 @@ impl FileDesc { Ok(ret as usize) } - #[cfg(any(target_os = "espidf", target_os = "horizon"))] + #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] pub fn read_vectored(&self, bufs: &mut [IoSliceMut<'_>]) -> io::Result { io::default_read_vectored(|b| self.read(b), bufs) } #[inline] pub fn is_read_vectored(&self) -> bool { - cfg!(not(any(target_os = "espidf", target_os = "horizon"))) + cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))) } pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { @@ -253,7 +254,7 @@ impl FileDesc { Ok(ret as usize) } - #[cfg(not(any(target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita")))] pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result { let ret = cvt(unsafe { libc::writev( @@ -265,14 +266,14 @@ impl FileDesc { Ok(ret as usize) } - #[cfg(any(target_os = "espidf", target_os = "horizon"))] + #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] pub fn write_vectored(&self, bufs: &[IoSlice<'_>]) -> io::Result { io::default_write_vectored(|b| self.write(b), bufs) } #[inline] pub fn is_write_vectored(&self) -> bool { - cfg!(not(any(target_os = "espidf", target_os = "horizon"))) + cfg!(not(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))) } pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result { diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs index b398fd5eb24b..22d2ae397137 100644 --- a/library/std/src/sys/unix/fs.rs +++ b/library/std/src/sys/unix/fs.rs @@ -447,7 +447,12 @@ impl FileAttr { #[cfg(not(any(target_os = "netbsd", target_os = "nto")))] impl FileAttr { - #[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any( + target_os = "vxworks", + target_os = "espidf", + target_os = "horizon", + target_os = "vita" + )))] pub fn modified(&self) -> io::Result { #[cfg(target_pointer_width = "32")] cfg_has_statx! { @@ -459,7 +464,7 @@ impl FileAttr { Ok(SystemTime::new(self.stat.st_mtime as i64, self.stat.st_mtime_nsec as i64)) } - #[cfg(any(target_os = "vxworks", target_os = "espidf"))] + #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))] pub fn modified(&self) -> io::Result { Ok(SystemTime::new(self.stat.st_mtime as i64, 0)) } @@ -469,7 +474,12 @@ impl FileAttr { Ok(SystemTime::from(self.stat.st_mtim)) } - #[cfg(not(any(target_os = "vxworks", target_os = "espidf", target_os = "horizon")))] + #[cfg(not(any( + target_os = "vxworks", + target_os = "espidf", + target_os = "horizon", + target_os = "vita" + )))] pub fn accessed(&self) -> io::Result { #[cfg(target_pointer_width = "32")] cfg_has_statx! { @@ -481,7 +491,7 @@ impl FileAttr { Ok(SystemTime::new(self.stat.st_atime as i64, self.stat.st_atime_nsec as i64)) } - #[cfg(any(target_os = "vxworks", target_os = "espidf"))] + #[cfg(any(target_os = "vxworks", target_os = "espidf", target_os = "vita"))] pub fn accessed(&self) -> io::Result { Ok(SystemTime::new(self.stat.st_atime as i64, 0)) } @@ -866,6 +876,7 @@ impl DirEntry { target_os = "vxworks", target_os = "espidf", target_os = "horizon", + target_os = "vita", target_os = "nto", ))] pub fn ino(&self) -> u64 { diff --git a/library/std/src/sys/unix/mod.rs b/library/std/src/sys/unix/mod.rs index 68c9520cc9eb..bb9e65e68e5e 100644 --- a/library/std/src/sys/unix/mod.rs +++ b/library/std/src/sys/unix/mod.rs @@ -92,6 +92,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_os = "redox", target_os = "l4re", target_os = "horizon", + target_os = "vita", )))] 'poll: { use crate::sys::os::errno; @@ -140,6 +141,7 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_os = "vxworks", target_os = "l4re", target_os = "horizon", + target_os = "vita", )))] { use crate::sys::os::errno; @@ -162,7 +164,12 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { } unsafe fn reset_sigpipe(#[allow(unused_variables)] sigpipe: u8) { - #[cfg(not(any(target_os = "emscripten", target_os = "fuchsia", target_os = "horizon")))] + #[cfg(not(any( + target_os = "emscripten", + target_os = "fuchsia", + target_os = "horizon", + target_os = "vita" + )))] { // We don't want to add this as a public type to std, nor do we // want to `include!` a file from the compiler (which would break @@ -199,7 +206,8 @@ pub unsafe fn init(argc: isize, argv: *const *const u8, sigpipe: u8) { target_os = "espidf", target_os = "emscripten", target_os = "fuchsia", - target_os = "horizon" + target_os = "horizon", + target_os = "vita" )))] static UNIX_SIGPIPE_ATTR_SPECIFIED: crate::sync::atomic::AtomicBool = crate::sync::atomic::AtomicBool::new(false); @@ -208,7 +216,8 @@ static UNIX_SIGPIPE_ATTR_SPECIFIED: crate::sync::atomic::AtomicBool = target_os = "espidf", target_os = "emscripten", target_os = "fuchsia", - target_os = "horizon" + target_os = "horizon", + target_os = "vita", )))] pub(crate) fn unix_sigpipe_attr_specified() -> bool { UNIX_SIGPIPE_ATTR_SPECIFIED.load(crate::sync::atomic::Ordering::Relaxed) @@ -402,7 +411,7 @@ cfg_if::cfg_if! { } } -#[cfg(any(target_os = "espidf", target_os = "horizon"))] +#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] mod unsupported { use crate::io; diff --git a/library/std/src/sys/unix/os.rs b/library/std/src/sys/unix/os.rs index a345af76fa21..8edfd3313044 100644 --- a/library/std/src/sys/unix/os.rs +++ b/library/std/src/sys/unix/os.rs @@ -460,7 +460,7 @@ pub fn current_exe() -> io::Result { path.canonicalize() } -#[cfg(any(target_os = "espidf", target_os = "horizon"))] +#[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] pub fn current_exe() -> io::Result { super::unsupported::unsupported() } @@ -614,7 +614,8 @@ pub fn home_dir() -> Option { target_os = "redox", target_os = "vxworks", target_os = "espidf", - target_os = "horizon" + target_os = "horizon", + target_os = "vita", ))] unsafe fn fallback() -> Option { None @@ -627,7 +628,8 @@ pub fn home_dir() -> Option { target_os = "redox", target_os = "vxworks", target_os = "espidf", - target_os = "horizon" + target_os = "horizon", + target_os = "vita", )))] unsafe fn fallback() -> Option { let amt = match libc::sysconf(libc::_SC_GETPW_R_SIZE_MAX) { diff --git a/library/std/src/sys/unix/process/mod.rs b/library/std/src/sys/unix/process/mod.rs index 3701510f3a42..0cf163d9fb8e 100644 --- a/library/std/src/sys/unix/process/mod.rs +++ b/library/std/src/sys/unix/process/mod.rs @@ -14,7 +14,7 @@ cfg_if::cfg_if! { } else if #[cfg(target_os = "vxworks")] { #[path = "process_vxworks.rs"] mod process_inner; - } else if #[cfg(any(target_os = "espidf", target_os = "horizon"))] { + } else if #[cfg(any(target_os = "espidf", target_os = "horizon", target_os = "vita"))] { #[path = "process_unsupported.rs"] mod process_inner; } else { diff --git a/library/std/src/sys/unix/rand.rs b/library/std/src/sys/unix/rand.rs index 0f347ffab42f..d8b63546b9ed 100644 --- a/library/std/src/sys/unix/rand.rs +++ b/library/std/src/sys/unix/rand.rs @@ -21,7 +21,8 @@ pub fn hashmap_random_keys() -> (u64, u64) { not(target_os = "fuchsia"), not(target_os = "redox"), not(target_os = "vxworks"), - not(target_os = "emscripten") + not(target_os = "emscripten"), + not(target_os = "vita"), ))] mod imp { use crate::fs::File; @@ -175,7 +176,7 @@ mod imp { } } -#[cfg(any(target_os = "openbsd", target_os = "emscripten"))] +#[cfg(any(target_os = "openbsd", target_os = "emscripten", target_os = "vita"))] mod imp { use crate::sys::os::errno; diff --git a/src/doc/rustc/src/platform-support/armv7-sony-vita-eabihf.md b/src/doc/rustc/src/platform-support/armv7-sony-vita-newlibeabihf.md similarity index 54% rename from src/doc/rustc/src/platform-support/armv7-sony-vita-eabihf.md rename to src/doc/rustc/src/platform-support/armv7-sony-vita-newlibeabihf.md index 6619c90b849d..d75bd92beda7 100644 --- a/src/doc/rustc/src/platform-support/armv7-sony-vita-eabihf.md +++ b/src/doc/rustc/src/platform-support/armv7-sony-vita-newlibeabihf.md @@ -1,26 +1,40 @@ -# armv7-sony-vita-eabihf +# armv7-sony-vita-newlibeabihf **Tier: 3** This tier supports the ARM Cortex A9 processor running on a PlayStation Vita console. `armv7-vita-newlibeabihf` aims to have support for `std` crate using `newlib` as a bridge. +Rust support for this target is not affiliated with Sony, and is not derived +from nor used with any official Sony SDK. + ## Designated Developers * [@amg98](https://github.com/amg98) +* [@nikarh](https://github.com/nikarh) ## Requirements -This target is cross compiled, and requires installing [VITASDK](https://vitasdk.org/) toolchain on your system. +This target is cross-compiled, and requires installing [VITASDK](https://vitasdk.org/) toolchain on your system. Dynamic linking is not supported. + +`#![no_std]` crates can be built using `build-std` to build `core`, and optionally +`alloc`, and `panic_abort`. + +`std` is partially supported, but mostly works. Some APIs are unimplemented +and will simply return an error, such as `std::process`. An allocator is provided +by default. + +In order to support some APIs, binaries must be linked against `libc` written +for the target, using a linker for the target. These are provided by the +VITASDK toolchain. + +This target generates binaries in the ELF format. ## Building -You can build Rust with support for the target by adding it to the `target` -list in `config.toml`: +Rust does not ship pre-compiled artifacts for this target. You can use `build-std` flag to build binaries with `std`: -```toml -[build] -build-stage = 1 -target = ["armv7-sony-vita-newlibeabihf"] +```sh +cargo build -Z build-std=std,panic_abort --target=armv7-sony-vita-newlibeabihf --release ``` ## Cross-compilation @@ -33,26 +47,81 @@ Currently there is no support to run the rustc test suite for this target. ## Building and Running Rust Programs -To test your developed rust programs for PlayStation Vita, first you have to prepare a proper executable for the device using the resulting ELF file you get from compilation step. The needed steps can be automated using tools like `cargo-make`. Use the example below as a template for your project: +`std` support for this target relies on newlib. In order to work, newlib must be initialized correctly. The easiest way to achieve this with VITASDK newlib implementation is by compiling your program as a staticlib with and exposing your main function from rust to `_init` function in `crt0`. + +Add this to your `Cargo.toml`: + +```toml +[lib] +crate-type = ["staticlib"] + +[profile.release] +panic = 'abort' +lto = true +opt-level = 3 +``` + +Your entrypoint should look roughly like this, `src/lib.rs`: +```rust,ignore,no_run +#[used] +#[export_name = "_newlib_heap_size_user"] +pub static _NEWLIB_HEAP_SIZE_USER: u32 = 100 * 1024 * 1024; // Default heap size is only 32mb, increase it to something suitable for your application + +#[no_mangle] +pub extern "C" fn main() { + println!("Hello, world!"); +} +``` + +To test your developed rust programs on PlayStation Vita, first you must correctly link and package your rust staticlib. These steps can be preformed using tools available in VITASDK, and can be automated using tools like `cargo-make`. + +First, set up environment variables for `VITASDK`, and it's binaries: + +```sh +export VITASDK=/opt/vitasdk +export PATH=$PATH:$VITASDK/bin +``` + +Use the example below as a template for your project: ```toml [env] TITLE = "Rust Hello World" TITLEID = "RUST00001" +# Add other libs required by your project here +LINKER_LIBS = "-lpthread -lm -lmathneon" + # At least a "sce_sys" folder should be place there for app metadata (title, icons, description...) # You can find sample assets for that on $VITASDK/share/gcc-arm-vita-eabi/samples/hello_world/sce_sys/ STATIC_DIR = "static" # Folder where static assets should be placed (sce_sys folder is at $STATIC_DIR/sce_sys) CARGO_TARGET_DIR = { script = ["echo ${CARGO_TARGET_DIR:=target}"] } -RUST_TARGET_PATH = { script = ["echo $(pwd)"]} RUST_TARGET = "armv7-sony-vita-newlibeabihf" CARGO_OUT_DIR = "${CARGO_TARGET_DIR}/${RUST_TARGET}/release" -[tasks.xbuild] -# This is the command where you get the ELF executable file (e.g. call to cargo build) +TARGET_LINKER = "arm-vita-eabi-gcc" +TARGET_LINKER_FLAGS = "-Wl,-q" + +[tasks.build] +description = "Build the project using `cargo` as a static lib." +command = "cargo" +args = ["build", "-Z", "build-std=std,panic_abort", "--target=armv7-sony-vita-newlibeabihf", "--release"] + +[tasks.link] +description = "Build an ELF executable using the `vitasdk` linker." +dependencies = ["build"] +script = [ + """ + ${TARGET_LINKER} ${TARGET_LINKER_FLAGS} \ + -L"${CARGO_OUT_DIR}" \ + -l"${CARGO_MAKE_CRATE_FS_NAME}" \ + ${LINKER_LIBS} \ + -o"${CARGO_OUT_DIR}/${CARGO_MAKE_CRATE_NAME}.elf" + """ +] [tasks.strip] description = "Strip the produced ELF executable." -dependencies = ["xbuild"] +dependencies = ["link"] command = "arm-vita-eabi-strip" args = ["-g", '${CARGO_OUT_DIR}/${CARGO_MAKE_CRATE_FS_NAME}.elf'] @@ -124,4 +193,4 @@ script = [ ] ``` -After running the above script, you should be able to get a *.vpk file in the same folder your *.elf executable resides. Now you can pick it and install it on your own PlayStation Vita using, for example, [VitaShell](https://github.com/TheOfficialFloW/VitaShell/releases) or you can use an emulator. For the time being, the most mature emulator for PlayStation Vita is [Vita3K](https://vita3k.org/), although I personally recommend testing your programs in real hardware, as the emulator is quite experimental. +After running the above script, you should be able to get a *.vpk file in the same folder your *.elf executable resides. Now you can pick it and install it on your own PlayStation Vita using, or you can use an [Vita3K](https://vita3k.org/) emulator. From 654f56e086fad836da5931e1a3defad804d9cfe9 Mon Sep 17 00:00:00 2001 From: jyn Date: Sun, 7 May 2023 11:19:13 -0500 Subject: [PATCH 60/97] Give a more helpful error when running the rustc shim directly cc https://rust-lang.zulipchat.com/#narrow/stream/326414-t-infra.2Fbootstrap/topic/Building.20.60coretests.60.20by.20hand --- src/bootstrap/bin/rustc.rs | 9 +++++++-- src/bootstrap/bin/rustdoc.rs | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs index dd86634b47c8..e87125a49a6a 100644 --- a/src/bootstrap/bin/rustc.rs +++ b/src/bootstrap/bin/rustc.rs @@ -19,7 +19,7 @@ include!("../dylib_util.rs"); use std::env; use std::path::PathBuf; -use std::process::{Child, Command}; +use std::process::{exit, Child, Command}; use std::str::FromStr; use std::time::Instant; @@ -47,7 +47,12 @@ fn main() { } else { ("RUSTC_REAL", "RUSTC_LIBDIR") }; - let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set"); + let stage = env::var("RUSTC_STAGE").unwrap_or_else(|_| { + // Don't panic here; it's reasonable to try and run these shims directly. Give a helpful error instead. + eprintln!("rustc shim: fatal: RUSTC_STAGE was not set"); + eprintln!("rustc shim: note: use `x.py build -vvv` to see all environment variables set by bootstrap"); + exit(101); + }); let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"); let on_fail = env::var_os("RUSTC_ON_FAIL").map(Command::new); diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs index 23828f4758d6..d2b85f7a6297 100644 --- a/src/bootstrap/bin/rustdoc.rs +++ b/src/bootstrap/bin/rustdoc.rs @@ -5,13 +5,18 @@ use std::env; use std::ffi::OsString; use std::path::PathBuf; -use std::process::Command; +use std::process::{exit, Command}; include!("../dylib_util.rs"); fn main() { let args = env::args_os().skip(1).collect::>(); - let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set"); + let stage = env::var("RUSTC_STAGE").unwrap_or_else(|_| { + // Don't panic here; it's reasonable to try and run these shims directly. Give a helpful error instead. + eprintln!("rustc shim: fatal: RUSTC_STAGE was not set"); + eprintln!("rustc shim: note: use `x.py build -vvv` to see all environment variables set by bootstrap"); + exit(101); + }); let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set"); let libdir = env::var_os("RUSTDOC_LIBDIR").expect("RUSTDOC_LIBDIR was not set"); let sysroot = env::var_os("RUSTC_SYSROOT").expect("RUSTC_SYSROOT was not set"); From f2645776dc5e519a0a0bd4e79f2801de197c2fbc Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Sun, 30 Apr 2023 19:08:46 +0200 Subject: [PATCH 61/97] Use smaller ints for bitflags --- compiler/rustc_data_structures/src/profiling.rs | 2 +- compiler/rustc_middle/src/ty/adt.rs | 2 +- compiler/rustc_middle/src/ty/mod.rs | 2 +- compiler/rustc_target/src/abi/call/mod.rs | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/rustc_data_structures/src/profiling.rs b/compiler/rustc_data_structures/src/profiling.rs index 572bd4ac21c3..5e13e7c8aafc 100644 --- a/compiler/rustc_data_structures/src/profiling.rs +++ b/compiler/rustc_data_structures/src/profiling.rs @@ -101,7 +101,7 @@ use parking_lot::RwLock; use smallvec::SmallVec; bitflags::bitflags! { - struct EventFilter: u32 { + struct EventFilter: u16 { const GENERIC_ACTIVITIES = 1 << 0; const QUERY_PROVIDERS = 1 << 1; const QUERY_CACHE_HITS = 1 << 2; diff --git a/compiler/rustc_middle/src/ty/adt.rs b/compiler/rustc_middle/src/ty/adt.rs index 6187fc43cf88..ad9891a5dca6 100644 --- a/compiler/rustc_middle/src/ty/adt.rs +++ b/compiler/rustc_middle/src/ty/adt.rs @@ -26,7 +26,7 @@ use super::{Destructor, FieldDef, GenericPredicates, Ty, TyCtxt, VariantDef, Var bitflags! { #[derive(HashStable, TyEncodable, TyDecodable)] - pub struct AdtFlags: u32 { + pub struct AdtFlags: u16 { const NO_ADT_FLAGS = 0; /// Indicates whether the ADT is an enum. const IS_ENUM = 1 << 0; diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 23d6242899f2..88b084bbccbd 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -1739,7 +1739,7 @@ pub struct Destructor { bitflags! { #[derive(HashStable, TyEncodable, TyDecodable)] - pub struct VariantFlags: u32 { + pub struct VariantFlags: u8 { const NO_VARIANT_FLAGS = 0; /// Indicates whether the field list of this variant is `#[non_exhaustive]`. const IS_FIELD_LIST_NON_EXHAUSTIVE = 1 << 0; diff --git a/compiler/rustc_target/src/abi/call/mod.rs b/compiler/rustc_target/src/abi/call/mod.rs index 57011aa8a147..52159a7b06aa 100644 --- a/compiler/rustc_target/src/abi/call/mod.rs +++ b/compiler/rustc_target/src/abi/call/mod.rs @@ -65,7 +65,7 @@ mod attr_impl { // The subset of llvm::Attribute needed for arguments, packed into a bitfield. bitflags::bitflags! { #[derive(Default, HashStable_Generic)] - pub struct ArgAttribute: u16 { + pub struct ArgAttribute: u8 { const NoAlias = 1 << 1; const NoCapture = 1 << 2; const NonNull = 1 << 3; From bb4976ab2daf56b02e3bc94c932927331bd61cb5 Mon Sep 17 00:00:00 2001 From: Wang Qilin Date: Mon, 8 May 2023 09:13:42 +0800 Subject: [PATCH 62/97] supplement CHANGELOG for add rpath in target section --- src/bootstrap/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bootstrap/CHANGELOG.md b/src/bootstrap/CHANGELOG.md index 74dd22df9e06..d6924cf2cfb2 100644 --- a/src/bootstrap/CHANGELOG.md +++ b/src/bootstrap/CHANGELOG.md @@ -27,6 +27,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). from the default rust toolchain. [#78513](https://github.com/rust-lang/rust/pull/78513) - Add options for enabling overflow checks, one for std (`overflow-checks-std`) and one for everything else (`overflow-checks`). Both default to false. - Add llvm option `enable-warnings` to have control on llvm compilation warnings. Default to false. +- Add `rpath` option in `target` section to support set rpath option for each target independently. [#111242](https://github.com/rust-lang/rust/pull/111242) ## [Version 2] - 2020-09-25 From 0bb43c63c33bf29e7a24e696f619be8e55e62f37 Mon Sep 17 00:00:00 2001 From: yukang Date: Wed, 3 May 2023 11:46:34 +0800 Subject: [PATCH 63/97] Suggest let for possible binding with ty --- compiler/rustc_macros/src/diagnostics/mod.rs | 2 +- compiler/rustc_parse/src/parser/diagnostics.rs | 17 +++++++++++++++++ compiler/rustc_parse/src/parser/stmt.rs | 9 --------- .../type-ascription-instead-of-let.fixed | 11 +++++++++++ .../type-ascription-instead-of-let.rs | 4 +++- .../type-ascription-instead-of-let.stderr | 7 ++++++- tests/ui/type/missing-let-in-binding-2.fixed | 5 +++++ tests/ui/type/missing-let-in-binding-2.rs | 5 +++++ tests/ui/type/missing-let-in-binding-2.stderr | 13 +++++++++++++ 9 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 tests/ui/suggestions/type-ascription-instead-of-let.fixed create mode 100644 tests/ui/type/missing-let-in-binding-2.fixed create mode 100644 tests/ui/type/missing-let-in-binding-2.rs create mode 100644 tests/ui/type/missing-let-in-binding-2.stderr diff --git a/compiler/rustc_macros/src/diagnostics/mod.rs b/compiler/rustc_macros/src/diagnostics/mod.rs index bd84681cbb44..a536eb3b04e6 100644 --- a/compiler/rustc_macros/src/diagnostics/mod.rs +++ b/compiler/rustc_macros/src/diagnostics/mod.rs @@ -140,7 +140,7 @@ pub fn lint_diagnostic_derive(s: Structure<'_>) -> TokenStream { /// ```fluent /// parser_expected_identifier = expected identifier /// -/// parser_expected_identifier-found = expected identifier, found {$found} +/// parser_expected_identifier_found = expected identifier, found {$found} /// /// parser_raw_identifier = escape `{$ident}` to use it as an identifier /// ``` diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 36883bd21721..e8f47346fa7c 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -399,6 +399,23 @@ impl<'a> Parser<'a> { } } } + // we suggest add the missing `let` before the identifier + // `a: Ty = 1` -> `let a: Ty = 1` + if self.token == token::Colon { + let prev_span = self.prev_token.span.shrink_to_lo(); + let snapshot = self.create_snapshot_for_diagnostic(); + self.bump(); + let res = self.parse_ty(); + if res.is_ok() && self.token == token::Eq { + err.span_suggestion_verbose( + prev_span, + "you might have meant to introduce a new binding", + "let ".to_string(), + Applicability::MaybeIncorrect, + ); + } + self.restore_snapshot(snapshot); + } if let Some(recovered_ident) = recovered_ident && recover { err.emit(); diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index 1c17de337e83..ab04219b1772 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -555,7 +555,6 @@ impl<'a> Parser<'a> { if self.token == token::Colon { // if next token is following a colon, it's likely a path // and we can suggest a path separator - let ident_span = self.prev_token.span; self.bump(); if self.token.span.lo() == self.prev_token.span.hi() { err.span_suggestion_verbose( @@ -565,14 +564,6 @@ impl<'a> Parser<'a> { Applicability::MaybeIncorrect, ); } - if self.look_ahead(1, |token| token == &token::Eq) { - err.span_suggestion_verbose( - ident_span.shrink_to_lo(), - "you might have meant to introduce a new binding", - "let ", - Applicability::MaybeIncorrect, - ); - } if self.sess.unstable_features.is_nightly_build() { // FIXME(Nilstrieb): Remove this again after a few months. err.note("type ascription syntax has been removed, see issue #101728 "); diff --git a/tests/ui/suggestions/type-ascription-instead-of-let.fixed b/tests/ui/suggestions/type-ascription-instead-of-let.fixed new file mode 100644 index 000000000000..e3d03b6f22ad --- /dev/null +++ b/tests/ui/suggestions/type-ascription-instead-of-let.fixed @@ -0,0 +1,11 @@ +// run-rustfix + +fn fun(x: i32) -> i32 { x } + +fn main() { + let _closure_annotated = |value: i32| -> i32 { + let temp: i32 = fun(5i32); + //~^ ERROR expected identifier, found `:` + temp + value + 1 + }; +} diff --git a/tests/ui/suggestions/type-ascription-instead-of-let.rs b/tests/ui/suggestions/type-ascription-instead-of-let.rs index 5ad602432986..6e1c86f96711 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-let.rs +++ b/tests/ui/suggestions/type-ascription-instead-of-let.rs @@ -1,7 +1,9 @@ +// run-rustfix + fn fun(x: i32) -> i32 { x } fn main() { - let closure_annotated = |value: i32| -> i32 { + let _closure_annotated = |value: i32| -> i32 { temp: i32 = fun(5i32); //~^ ERROR expected identifier, found `:` temp + value + 1 diff --git a/tests/ui/suggestions/type-ascription-instead-of-let.stderr b/tests/ui/suggestions/type-ascription-instead-of-let.stderr index fb697b0ccfd5..065b1f4d3538 100644 --- a/tests/ui/suggestions/type-ascription-instead-of-let.stderr +++ b/tests/ui/suggestions/type-ascription-instead-of-let.stderr @@ -1,8 +1,13 @@ error: expected identifier, found `:` - --> $DIR/type-ascription-instead-of-let.rs:5:13 + --> $DIR/type-ascription-instead-of-let.rs:7:13 | LL | temp: i32 = fun(5i32); | ^ expected identifier + | +help: you might have meant to introduce a new binding + | +LL | let temp: i32 = fun(5i32); + | +++ error: aborting due to previous error diff --git a/tests/ui/type/missing-let-in-binding-2.fixed b/tests/ui/type/missing-let-in-binding-2.fixed new file mode 100644 index 000000000000..d64013c8c838 --- /dev/null +++ b/tests/ui/type/missing-let-in-binding-2.fixed @@ -0,0 +1,5 @@ +// run-rustfix + +fn main() { + let _v: Vec = vec![1, 2, 3]; //~ ERROR expected identifier, found `:` +} diff --git a/tests/ui/type/missing-let-in-binding-2.rs b/tests/ui/type/missing-let-in-binding-2.rs new file mode 100644 index 000000000000..f95f7bef2158 --- /dev/null +++ b/tests/ui/type/missing-let-in-binding-2.rs @@ -0,0 +1,5 @@ +// run-rustfix + +fn main() { + _v: Vec = vec![1, 2, 3]; //~ ERROR expected identifier, found `:` +} diff --git a/tests/ui/type/missing-let-in-binding-2.stderr b/tests/ui/type/missing-let-in-binding-2.stderr new file mode 100644 index 000000000000..2e10125943e7 --- /dev/null +++ b/tests/ui/type/missing-let-in-binding-2.stderr @@ -0,0 +1,13 @@ +error: expected identifier, found `:` + --> $DIR/missing-let-in-binding-2.rs:4:7 + | +LL | _v: Vec = vec![1, 2, 3]; + | ^ expected identifier + | +help: you might have meant to introduce a new binding + | +LL | let _v: Vec = vec![1, 2, 3]; + | +++ + +error: aborting due to previous error + From 20e6e6a4932991c4b53605154868cfa645b04998 Mon Sep 17 00:00:00 2001 From: yukang Date: Wed, 3 May 2023 11:56:19 +0800 Subject: [PATCH 64/97] cleanup --- compiler/rustc_parse/src/parser/diagnostics.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index e8f47346fa7c..bd0ea50b4d8c 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -405,8 +405,7 @@ impl<'a> Parser<'a> { let prev_span = self.prev_token.span.shrink_to_lo(); let snapshot = self.create_snapshot_for_diagnostic(); self.bump(); - let res = self.parse_ty(); - if res.is_ok() && self.token == token::Eq { + if self.parse_ty().is_ok() && self.token == token::Eq { err.span_suggestion_verbose( prev_span, "you might have meant to introduce a new binding", From 8ad78cb02c62af59e750082c538968430d9c0cdd Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Mon, 8 May 2023 11:05:46 +0800 Subject: [PATCH 65/97] Mark LoongArch float-point condition flags as clobbered in inline assembly --- compiler/rustc_codegen_llvm/src/asm.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_codegen_llvm/src/asm.rs b/compiler/rustc_codegen_llvm/src/asm.rs index f9af103c9ad8..645b5b41c6bf 100644 --- a/compiler/rustc_codegen_llvm/src/asm.rs +++ b/compiler/rustc_codegen_llvm/src/asm.rs @@ -236,7 +236,18 @@ impl<'ll, 'tcx> AsmBuilderMethods<'tcx> for Builder<'_, 'll, 'tcx> { InlineAsmArch::Nvptx64 => {} InlineAsmArch::PowerPC | InlineAsmArch::PowerPC64 => {} InlineAsmArch::Hexagon => {} - InlineAsmArch::LoongArch64 => {} + InlineAsmArch::LoongArch64 => { + constraints.extend_from_slice(&[ + "~{$fcc0}".to_string(), + "~{$fcc1}".to_string(), + "~{$fcc2}".to_string(), + "~{$fcc3}".to_string(), + "~{$fcc4}".to_string(), + "~{$fcc5}".to_string(), + "~{$fcc6}".to_string(), + "~{$fcc7}".to_string(), + ]); + } InlineAsmArch::Mips | InlineAsmArch::Mips64 => {} InlineAsmArch::S390x => {} InlineAsmArch::SpirV => {} From c5382adc65119d55ac5045049d6cff095f6d111f Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Mon, 8 May 2023 11:07:56 +0800 Subject: [PATCH 66/97] Simplify match statement since variable arch that is predictable --- compiler/rustc_target/src/asm/loongarch.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/compiler/rustc_target/src/asm/loongarch.rs b/compiler/rustc_target/src/asm/loongarch.rs index 7ace1647ded4..9d1a4f3eeeaf 100644 --- a/compiler/rustc_target/src/asm/loongarch.rs +++ b/compiler/rustc_target/src/asm/loongarch.rs @@ -33,12 +33,11 @@ impl LoongArchInlineAsmRegClass { pub fn supported_types( self, - arch: InlineAsmArch, + _arch: InlineAsmArch, ) -> &'static [(InlineAsmType, Option)] { - match (self, arch) { - (Self::reg, InlineAsmArch::LoongArch64) => types! { _: I8, I16, I32, I64, F32, F64; }, - (Self::reg, _) => types! { _: I8, I16, I32, F32; }, - (Self::freg, _) => types! { _: F32, F64; }, + match self { + Self::reg => types! { _: I8, I16, I32, I64, F32, F64; }, + Self::freg => types! { _: F32, F64; }, } } } From a7fc32ceaf4708a26a992f61c4ac4ead1555c8eb Mon Sep 17 00:00:00 2001 From: yukang Date: Mon, 8 May 2023 11:16:17 +0800 Subject: [PATCH 67/97] fix ice in suggesting --- .../rustc_parse/src/parser/diagnostics.rs | 21 ++++++++++++------- tests/ui/type/missing-let-in-binding-3.rs | 5 +++++ tests/ui/type/missing-let-in-binding-3.stderr | 10 +++++++++ 3 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 tests/ui/type/missing-let-in-binding-3.rs create mode 100644 tests/ui/type/missing-let-in-binding-3.stderr diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index bd0ea50b4d8c..456c6243bbbb 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -405,13 +405,20 @@ impl<'a> Parser<'a> { let prev_span = self.prev_token.span.shrink_to_lo(); let snapshot = self.create_snapshot_for_diagnostic(); self.bump(); - if self.parse_ty().is_ok() && self.token == token::Eq { - err.span_suggestion_verbose( - prev_span, - "you might have meant to introduce a new binding", - "let ".to_string(), - Applicability::MaybeIncorrect, - ); + match self.parse_ty() { + Ok(_) => { + if self.token == token::Eq { + err.span_suggestion_verbose( + prev_span, + "you might have meant to introduce a new binding", + "let ".to_string(), + Applicability::MaybeIncorrect, + ); + } + } + Err(err) => { + err.cancel(); + } } self.restore_snapshot(snapshot); } diff --git a/tests/ui/type/missing-let-in-binding-3.rs b/tests/ui/type/missing-let-in-binding-3.rs new file mode 100644 index 000000000000..d56b1393336b --- /dev/null +++ b/tests/ui/type/missing-let-in-binding-3.rs @@ -0,0 +1,5 @@ +struct A { + : :u8, //~ ERROR expected identifier, found `:` +} + +fn main() {} diff --git a/tests/ui/type/missing-let-in-binding-3.stderr b/tests/ui/type/missing-let-in-binding-3.stderr new file mode 100644 index 000000000000..ca828ce37eb7 --- /dev/null +++ b/tests/ui/type/missing-let-in-binding-3.stderr @@ -0,0 +1,10 @@ +error: expected identifier, found `:` + --> $DIR/missing-let-in-binding-3.rs:2:5 + | +LL | struct A { + | - while parsing this struct +LL | : :u8, + | ^ expected identifier + +error: aborting due to previous error + From 2b9279f3131056a1a1dd5de7513de4eb98987770 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 3 May 2023 23:22:57 +0000 Subject: [PATCH 68/97] Diagnostic args are still args if they're documented --- .../src/diagnostics/subdiagnostic.rs | 12 ++--- .../rustc_macros/src/diagnostics/utils.rs | 3 +- .../diagnostic-derive-doc-comment-field.rs | 47 +++++++++++++++++++ ...diagnostic-derive-doc-comment-field.stderr | 43 +++++++++++++++++ 4 files changed, 97 insertions(+), 8 deletions(-) create mode 100644 tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs create mode 100644 tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs index 62d49c1c64e2..83b47f8acfbd 100644 --- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs +++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs @@ -4,17 +4,16 @@ use crate::diagnostics::error::{ invalid_attr, span_err, throw_invalid_attr, throw_span_err, DiagnosticDeriveError, }; use crate::diagnostics::utils::{ - build_field_mapping, is_doc_comment, new_code_ident, - report_error_if_not_applied_to_applicability, report_error_if_not_applied_to_span, FieldInfo, - FieldInnerTy, FieldMap, HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind, + build_field_mapping, build_suggestion_code, is_doc_comment, new_code_ident, + report_error_if_not_applied_to_applicability, report_error_if_not_applied_to_span, + should_generate_set_arg, AllowMultipleAlternatives, FieldInfo, FieldInnerTy, FieldMap, + HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind, }; use proc_macro2::TokenStream; use quote::{format_ident, quote}; use syn::{spanned::Spanned, Attribute, Meta, MetaList, Path}; use synstructure::{BindingInfo, Structure, VariantInfo}; -use super::utils::{build_suggestion_code, AllowMultipleAlternatives}; - /// The central struct for constructing the `add_to_diagnostic` method from an annotated struct. pub(crate) struct SubdiagnosticDeriveBuilder { diag: syn::Ident, @@ -212,7 +211,6 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { /// Generates the code for a field with no attributes. fn generate_field_set_arg(&mut self, binding: &BindingInfo<'_>) -> TokenStream { let ast = binding.ast(); - assert_eq!(ast.attrs.len(), 0, "field with attribute used as diagnostic arg"); let diag = &self.parent.diag; let ident = ast.ident.as_ref().unwrap(); @@ -580,7 +578,7 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { .variant .bindings() .iter() - .filter(|binding| binding.ast().attrs.is_empty()) + .filter(|binding| should_generate_set_arg(binding.ast())) .map(|binding| self.generate_field_set_arg(binding)) .collect(); diff --git a/compiler/rustc_macros/src/diagnostics/utils.rs b/compiler/rustc_macros/src/diagnostics/utils.rs index b9b09c66230b..bc97e39bebd8 100644 --- a/compiler/rustc_macros/src/diagnostics/utils.rs +++ b/compiler/rustc_macros/src/diagnostics/utils.rs @@ -851,7 +851,8 @@ impl quote::IdentFragment for SubdiagnosticKind { /// Returns `true` if `field` should generate a `set_arg` call rather than any other diagnostic /// call (like `span_label`). pub(super) fn should_generate_set_arg(field: &Field) -> bool { - field.attrs.is_empty() + // Perhaps this should be an exhaustive list... + field.attrs.iter().all(|attr| is_doc_comment(attr)) } pub(super) fn is_doc_comment(attr: &Attribute) -> bool { diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs new file mode 100644 index 000000000000..7e1f7b1c5c10 --- /dev/null +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs @@ -0,0 +1,47 @@ +// check-fail +// Tests that a doc comment will not preclude a field from being considered a diagnostic argument + +// The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, +// changing the output of this test. Since Subdiagnostic is strictly internal to the compiler +// the test is just ignored on stable and beta: +// ignore-stage1 +// ignore-beta +// ignore-stable + +#![feature(rustc_private)] +#![crate_type = "lib"] + +extern crate rustc_errors; +extern crate rustc_fluent_macro; +extern crate rustc_macros; +extern crate rustc_session; +extern crate rustc_span; + +use rustc_errors::{Applicability, DiagnosticMessage, SubdiagnosticMessage}; +use rustc_fluent_macro::fluent_messages; +use rustc_macros::{Diagnostic, Subdiagnostic}; +use rustc_span::Span; + +fluent_messages! { "./example.ftl" } + +struct NotIntoDiagnosticArg; + +#[derive(Diagnostic)] +//~^ ERROR the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied +#[diag(no_crate_example)] +struct Test { + #[primary_span] + span: Span, + /// A doc comment + arg: NotIntoDiagnosticArg, +} + +#[derive(Subdiagnostic)] +//~^ ERROR the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied +#[label(no_crate_example)] +struct SubTest { + #[primary_span] + span: Span, + /// A doc comment + arg: NotIntoDiagnosticArg, +} diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr new file mode 100644 index 000000000000..27044748d080 --- /dev/null +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr @@ -0,0 +1,43 @@ +error[E0277]: the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied + --> $DIR/diagnostic-derive-doc-comment-field.rs:29:10 + | +LL | #[derive(Diagnostic)] + | ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` + | + = help: the following other types implement trait `IntoDiagnosticArg`: + &'a T + &'a std::path::Path + &'a str + &rustc_target::spec::TargetTriple + Box<(dyn std::error::Error + 'static)> + CString + CguReuse + Cow<'a, str> + and 42 others +note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` + --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:747:5 + = note: this error originates in the derive macro `Diagnostic` which comes from the expansion of the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) + +error[E0277]: the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied + --> $DIR/diagnostic-derive-doc-comment-field.rs:39:10 + | +LL | #[derive(Subdiagnostic)] + | ^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` + | + = help: the following other types implement trait `IntoDiagnosticArg`: + &'a T + &'a std::path::Path + &'a str + &rustc_target::spec::TargetTriple + Box<(dyn std::error::Error + 'static)> + CString + CguReuse + Cow<'a, str> + and 42 others +note: required by a bound in `Diagnostic::set_arg` + --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:964:5 + = note: this error originates in the derive macro `Subdiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0277`. From 35985091cc0bf18d40f9fdf9bcb81e3dd74f253b Mon Sep 17 00:00:00 2001 From: John Bobbo Date: Mon, 1 May 2023 01:34:01 -0700 Subject: [PATCH 69/97] Fix suggestion for boxing an async closure body, and also add a suggestion for boxing empty blocks. --- compiler/rustc_hir_typeck/messages.ftl | 4 ++ compiler/rustc_hir_typeck/src/demand.rs | 2 +- compiler/rustc_hir_typeck/src/errors.rs | 28 +++++++++++ .../rustc_hir_typeck/src/fn_ctxt/checks.rs | 20 +++++--- .../src/fn_ctxt/suggestions.rs | 48 +++++++++---------- tests/ui/issues/auxiliary/issue-111011.rs | 12 +++++ tests/ui/issues/auxiliary/issue-111011.stderr | 34 +++++++++++++ .../suggest-boxed-empty-block.fixed | 12 +++++ .../suggestions/suggest-boxed-empty-block.rs | 12 +++++ .../suggest-boxed-empty-block.stderr | 33 +++++++++++++ 10 files changed, 174 insertions(+), 31 deletions(-) create mode 100644 tests/ui/issues/auxiliary/issue-111011.rs create mode 100644 tests/ui/issues/auxiliary/issue-111011.stderr create mode 100644 tests/ui/suggestions/suggest-boxed-empty-block.fixed create mode 100644 tests/ui/suggestions/suggest-boxed-empty-block.rs create mode 100644 tests/ui/suggestions/suggest-boxed-empty-block.stderr diff --git a/compiler/rustc_hir_typeck/messages.ftl b/compiler/rustc_hir_typeck/messages.ftl index 603ea1440e9c..aa664031a874 100644 --- a/compiler/rustc_hir_typeck/messages.ftl +++ b/compiler/rustc_hir_typeck/messages.ftl @@ -75,3 +75,7 @@ hir_typeck_union_pat_dotdot = `..` cannot be used in union patterns hir_typeck_arg_mismatch_indeterminate = argument type mismatch was detected, but rustc had trouble determining where .note = we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new + +hir_typeck_suggest_boxing_note = for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html + +hir_typeck_suggest_boxing_when_appropriate = store this in the heap by calling `Box::new` diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index b8222820cf7a..cfeb7f25533e 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -51,7 +51,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { || self.suggest_non_zero_new_unwrap(err, expr, expected, expr_ty) || self.suggest_calling_boxed_future_when_appropriate(err, expr, expected, expr_ty) || self.suggest_no_capture_closure(err, expected, expr_ty) - || self.suggest_boxing_when_appropriate(err, expr, expected, expr_ty) + || self.suggest_boxing_when_appropriate(err, expr.span, expr.hir_id, expected, expr_ty) || self.suggest_block_to_brackets_peeling_refs(err, expr, expr_ty, expected) || self.suggest_copied_or_cloned(err, expr, expr_ty, expected) || self.suggest_clone_for_ref(err, expr, expr_ty, expected) diff --git a/compiler/rustc_hir_typeck/src/errors.rs b/compiler/rustc_hir_typeck/src/errors.rs index 48c40d216034..ce30bbeca0ba 100644 --- a/compiler/rustc_hir_typeck/src/errors.rs +++ b/compiler/rustc_hir_typeck/src/errors.rs @@ -267,3 +267,31 @@ pub struct ArgMismatchIndeterminate { #[primary_span] pub span: Span, } + +#[derive(Subdiagnostic)] +pub enum SuggestBoxing { + #[note(hir_typeck_suggest_boxing_note)] + #[multipart_suggestion( + hir_typeck_suggest_boxing_when_appropriate, + applicability = "machine-applicable" + )] + Unit { + #[suggestion_part(code = "Box::new(())")] + start: Span, + #[suggestion_part(code = "")] + end: Span, + }, + #[note(hir_typeck_suggest_boxing_note)] + AsyncBody, + #[note(hir_typeck_suggest_boxing_note)] + #[multipart_suggestion( + hir_typeck_suggest_boxing_when_appropriate, + applicability = "machine-applicable" + )] + Other { + #[suggestion_part(code = "Box::new(")] + start: Span, + #[suggestion_part(code = ")")] + end: Span, + }, +} diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs index f42c825d9e8b..e620aa6a291f 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs @@ -1514,7 +1514,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // case we can ignore the tail expression (e.g., `'a: { // break 'a 22; }` would not force the type of the block // to be `()`). - let tail_expr = blk.expr.as_ref(); let coerce_to_ty = expected.coercion_target_type(self, blk.span); let coerce = if blk.targeted_by_break { CoerceMany::new(coerce_to_ty) @@ -1532,13 +1531,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // check the tail expression **without** holding the // `enclosing_breakables` lock below. - let tail_expr_ty = tail_expr.map(|t| self.check_expr_with_expectation(t, expected)); + let tail_expr_ty = + blk.expr.map(|expr| (expr, self.check_expr_with_expectation(expr, expected))); let mut enclosing_breakables = self.enclosing_breakables.borrow_mut(); let ctxt = enclosing_breakables.find_breakable(blk.hir_id); let coerce = ctxt.coerce.as_mut().unwrap(); - if let Some(tail_expr_ty) = tail_expr_ty { - let tail_expr = tail_expr.unwrap(); + if let Some((tail_expr, tail_expr_ty)) = tail_expr_ty { let span = self.get_expr_coercion_span(tail_expr); let cause = self.cause(span, ObligationCauseCode::BlockTailExpression(blk.hir_id)); let ty_for_diagnostic = coerce.merged_ty(); @@ -1591,6 +1590,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { &self.misc(sp), &mut |err| { if let Some(expected_ty) = expected.only_has_type(self) { + if blk.stmts.is_empty() && blk.expr.is_none() { + self.suggest_boxing_when_appropriate( + err, + blk.span, + blk.hir_id, + expected_ty, + self.tcx.mk_unit(), + ); + } if !self.consider_removing_semicolon(blk, expected_ty, err) { self.err_ctxt().consider_returning_binding( blk, @@ -1603,7 +1611,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // silence this redundant error, as we already emit E0070. // Our block must be a `assign desugar local; assignment` - if let Some(hir::Node::Block(hir::Block { + if let hir::Block { stmts: [ hir::Stmt { @@ -1625,7 +1633,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { }, ], .. - })) = self.tcx.hir().find(blk.hir_id) + } = blk { self.comes_from_while_condition(blk.hir_id, |_| { err.downgrade_to_delayed_bug(); diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 82fc1256bba6..3f95027d3b86 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -1,6 +1,6 @@ use super::FnCtxt; -use crate::errors::{AddReturnTypeSuggestion, ExpectedReturnTypeLabel}; +use crate::errors::{AddReturnTypeSuggestion, ExpectedReturnTypeLabel, SuggestBoxing}; use crate::fluent_generated as fluent; use crate::method::probe::{IsSuggestion, Mode, ProbeScope}; use rustc_ast::util::parser::{ExprPrecedence, PREC_POSTFIX}; @@ -9,7 +9,8 @@ use rustc_hir as hir; use rustc_hir::def::{CtorKind, CtorOf, DefKind}; use rustc_hir::lang_items::LangItem; use rustc_hir::{ - Expr, ExprKind, GenericBound, Node, Path, QPath, Stmt, StmtKind, TyKind, WherePredicate, + AsyncGeneratorKind, Expr, ExprKind, GeneratorKind, GenericBound, HirId, Node, Path, QPath, + Stmt, StmtKind, TyKind, WherePredicate, }; use rustc_hir_analysis::astconv::AstConv; use rustc_infer::traits::{self, StatementAsExpression}; @@ -438,33 +439,32 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { pub(in super::super) fn suggest_boxing_when_appropriate( &self, err: &mut Diagnostic, - expr: &hir::Expr<'_>, + span: Span, + hir_id: HirId, expected: Ty<'tcx>, found: Ty<'tcx>, ) -> bool { - if self.tcx.hir().is_inside_const_context(expr.hir_id) { - // Do not suggest `Box::new` in const context. + // Do not suggest `Box::new` in const context. + if self.tcx.hir().is_inside_const_context(hir_id) || !expected.is_box() || found.is_box() { return false; } - if !expected.is_box() || found.is_box() { - return false; - } - let boxed_found = self.tcx.mk_box(found); - if self.can_coerce(boxed_found, expected) { - err.multipart_suggestion( - "store this in the heap by calling `Box::new`", - vec![ - (expr.span.shrink_to_lo(), "Box::new(".to_string()), - (expr.span.shrink_to_hi(), ")".to_string()), - ], - Applicability::MachineApplicable, - ); - err.note( - "for more on the distinction between the stack and the heap, read \ - https://doc.rust-lang.org/book/ch15-01-box.html, \ - https://doc.rust-lang.org/rust-by-example/std/box.html, and \ - https://doc.rust-lang.org/std/boxed/index.html", - ); + if self.can_coerce(self.tcx.mk_box(found), expected) { + let suggest_boxing = match found.kind() { + ty::Tuple(tuple) if tuple.is_empty() => { + SuggestBoxing::Unit { start: span.shrink_to_lo(), end: span } + } + ty::Generator(def_id, ..) + if matches!( + self.tcx.generator_kind(def_id), + Some(GeneratorKind::Async(AsyncGeneratorKind::Closure)) + ) => + { + SuggestBoxing::AsyncBody + } + _ => SuggestBoxing::Other { start: span.shrink_to_lo(), end: span.shrink_to_hi() }, + }; + err.subdiagnostic(suggest_boxing); + true } else { false diff --git a/tests/ui/issues/auxiliary/issue-111011.rs b/tests/ui/issues/auxiliary/issue-111011.rs new file mode 100644 index 000000000000..927134a588c1 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-111011.rs @@ -0,0 +1,12 @@ +#![feature(async_closure)] + +// edition:2021 + +fn foo(x: impl FnOnce() -> Box) {} +// just to make sure async closures can still be suggested for boxing. +fn bar(x: Box X>) {} + +fn main() { + foo(async move || {}); //~ ERROR mismatched types + bar(async move || {}); //~ ERROR mismatched types +} diff --git a/tests/ui/issues/auxiliary/issue-111011.stderr b/tests/ui/issues/auxiliary/issue-111011.stderr new file mode 100644 index 000000000000..082f0f035ad4 --- /dev/null +++ b/tests/ui/issues/auxiliary/issue-111011.stderr @@ -0,0 +1,34 @@ +error[E0308]: mismatched types + --> $DIR/issue-111011.rs:10:23 + | +LL | foo(async move || {}); + | ^^ expected `Box<_>`, found `async` closure body + | + = note: expected struct `Box<_>` + found `async` closure body `[async closure body@$DIR/issue-111011.rs:10:23: 10:25]` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html + +error[E0308]: mismatched types + --> $DIR/issue-111011.rs:11:9 + | +LL | bar(async move || {}); + | --- ^^^^^^^^^^^^^^^^ expected `Box _>`, found closure + | | + | arguments to this function are incorrect + | + = note: expected struct `Box<(dyn FnOnce() -> _ + 'static)>` + found closure `[closure@$DIR/issue-111011.rs:11:9: 11:22]` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +note: function defined here + --> $DIR/issue-111011.rs:7:4 + | +LL | fn bar(x: Box X>) {} + | ^^^ ------------------------- +help: store this in the heap by calling `Box::new` + | +LL | bar(Box::new(async move || {})); + | +++++++++ + + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.fixed b/tests/ui/suggestions/suggest-boxed-empty-block.fixed new file mode 100644 index 000000000000..46683aa09535 --- /dev/null +++ b/tests/ui/suggestions/suggest-boxed-empty-block.fixed @@ -0,0 +1,12 @@ +#![feature(async_closure)] + +// edition:2021 +// run-rustfix + +fn foo(_: Box) {} +fn bar(_: impl Fn() -> Box) {} + +fn main() { + foo(Box::new(())); //~ ERROR mismatched types + bar(|| Box::new(())); //~ ERROR mismatched types +} diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.rs b/tests/ui/suggestions/suggest-boxed-empty-block.rs new file mode 100644 index 000000000000..e19670a50184 --- /dev/null +++ b/tests/ui/suggestions/suggest-boxed-empty-block.rs @@ -0,0 +1,12 @@ +#![feature(async_closure)] + +// edition:2021 +// run-rustfix + +fn foo(_: Box) {} +fn bar(_: impl Fn() -> Box) {} + +fn main() { + foo({}); //~ ERROR mismatched types + bar(|| {}); //~ ERROR mismatched types +} diff --git a/tests/ui/suggestions/suggest-boxed-empty-block.stderr b/tests/ui/suggestions/suggest-boxed-empty-block.stderr new file mode 100644 index 000000000000..474a37b888f3 --- /dev/null +++ b/tests/ui/suggestions/suggest-boxed-empty-block.stderr @@ -0,0 +1,33 @@ +error[E0308]: mismatched types + --> $DIR/suggest-boxed-empty-block.rs:10:9 + | +LL | foo({}); + | ^^ expected `Box<_>`, found `()` + | + = note: expected struct `Box<_>` + found unit type `()` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL - foo({}); +LL + foo(Box::new(())); + | + +error[E0308]: mismatched types + --> $DIR/suggest-boxed-empty-block.rs:11:12 + | +LL | bar(|| {}); + | ^^ expected `Box<_>`, found `()` + | + = note: expected struct `Box<_>` + found unit type `()` + = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html +help: store this in the heap by calling `Box::new` + | +LL - bar(|| {}); +LL + bar(|| Box::new(())); + | + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. From a156bd771457110415b1eec74cf52c9502d461a3 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Wed, 3 May 2023 23:53:44 +0000 Subject: [PATCH 70/97] Make spans a bit better --- .../src/diagnostics/diagnostic_builder.rs | 9 ++-- .../src/diagnostics/subdiagnostic.rs | 21 ++++++---- .../rustc_macros/src/diagnostics/utils.rs | 6 +++ .../diagnostic-derive-doc-comment-field.rs | 6 ++- ...diagnostic-derive-doc-comment-field.stderr | 41 +++++++------------ .../session-diagnostic/diagnostic-derive.rs | 2 +- .../diagnostic-derive.stderr | 9 ++-- 7 files changed, 48 insertions(+), 46 deletions(-) diff --git a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs index 427c82c410b9..cd6e36874603 100644 --- a/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs +++ b/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs @@ -9,7 +9,7 @@ use crate::diagnostics::utils::{ FieldInnerTy, FieldMap, HasFieldMap, SetOnce, SpannedOption, SubdiagnosticKind, }; use proc_macro2::{Ident, Span, TokenStream}; -use quote::{format_ident, quote}; +use quote::{format_ident, quote, quote_spanned}; use syn::Token; use syn::{parse_quote, spanned::Spanned, Attribute, Meta, Path, Type}; use synstructure::{BindingInfo, Structure, VariantInfo}; @@ -251,7 +251,8 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> { let diag = &self.parent.diag; let field = binding_info.ast(); - let field_binding = &binding_info.binding; + let mut field_binding = binding_info.binding.clone(); + field_binding.set_span(field.ty.span()); let ident = field.ident.as_ref().unwrap(); let ident = format_ident!("{}", ident); // strip `r#` prefix, if present @@ -284,9 +285,9 @@ impl<'a> DiagnosticDeriveVariantBuilder<'a> { name == "primary_span" && matches!(inner_ty, FieldInnerTy::Vec(_)); let (binding, needs_destructure) = if needs_clone { // `primary_span` can accept a `Vec` so don't destructure that. - (quote! { #field_binding.clone() }, false) + (quote_spanned! {inner_ty.span()=> #field_binding.clone() }, false) } else { - (quote! { #field_binding }, true) + (quote_spanned! {inner_ty.span()=> #field_binding }, true) }; let generated_code = self diff --git a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs index 83b47f8acfbd..374ba1a45c06 100644 --- a/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs +++ b/compiler/rustc_macros/src/diagnostics/subdiagnostic.rs @@ -209,18 +209,20 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { } /// Generates the code for a field with no attributes. - fn generate_field_set_arg(&mut self, binding: &BindingInfo<'_>) -> TokenStream { - let ast = binding.ast(); - + fn generate_field_set_arg(&mut self, binding_info: &BindingInfo<'_>) -> TokenStream { let diag = &self.parent.diag; - let ident = ast.ident.as_ref().unwrap(); - // strip `r#` prefix, if present - let ident = format_ident!("{}", ident); + + let field = binding_info.ast(); + let mut field_binding = binding_info.binding.clone(); + field_binding.set_span(field.ty.span()); + + let ident = field.ident.as_ref().unwrap(); + let ident = format_ident!("{}", ident); // strip `r#` prefix, if present quote! { #diag.set_arg( stringify!(#ident), - #binding + #field_binding ); } } @@ -397,7 +399,8 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { clone_suggestion_code: bool, ) -> Result { let span = attr.span().unwrap(); - let ident = &list.path.segments.last().unwrap().ident; + let mut ident = list.path.segments.last().unwrap().ident.clone(); + ident.set_span(info.ty.span()); let name = ident.to_string(); let name = name.as_str(); @@ -496,7 +499,7 @@ impl<'parent, 'a> SubdiagnosticDeriveVariantBuilder<'parent, 'a> { .variant .bindings() .iter() - .filter(|binding| !binding.ast().attrs.is_empty()) + .filter(|binding| !should_generate_set_arg(binding.ast())) .map(|binding| self.generate_field_attr_code(binding, kind_stats)) .collect(); diff --git a/compiler/rustc_macros/src/diagnostics/utils.rs b/compiler/rustc_macros/src/diagnostics/utils.rs index bc97e39bebd8..e2434981f8d1 100644 --- a/compiler/rustc_macros/src/diagnostics/utils.rs +++ b/compiler/rustc_macros/src/diagnostics/utils.rs @@ -207,6 +207,12 @@ impl<'ty> FieldInnerTy<'ty> { FieldInnerTy::Plain(..) => quote! { #inner }, } } + + pub fn span(&self) -> proc_macro2::Span { + match self { + FieldInnerTy::Option(ty) | FieldInnerTy::Vec(ty) | FieldInnerTy::Plain(ty) => ty.span(), + } + } } /// Field information passed to the builder. Deliberately omits attrs to discourage the diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs index 7e1f7b1c5c10..642b58b0753f 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.rs @@ -1,5 +1,7 @@ // check-fail // Tests that a doc comment will not preclude a field from being considered a diagnostic argument +// normalize-stderr-test "the following other types implement trait `IntoDiagnosticArg`:(?:.*\n){0,9}\s+and \d+ others" -> "normalized in stderr" +// normalize-stderr-test "diagnostic_builder\.rs:[0-9]+:[0-9]+" -> "diagnostic_builder.rs:LL:CC" // The proc_macro2 crate handles spans differently when on beta/stable release rather than nightly, // changing the output of this test. Since Subdiagnostic is strictly internal to the compiler @@ -27,21 +29,21 @@ fluent_messages! { "./example.ftl" } struct NotIntoDiagnosticArg; #[derive(Diagnostic)] -//~^ ERROR the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied #[diag(no_crate_example)] struct Test { #[primary_span] span: Span, /// A doc comment arg: NotIntoDiagnosticArg, + //~^ ERROR the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied } #[derive(Subdiagnostic)] -//~^ ERROR the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied #[label(no_crate_example)] struct SubTest { #[primary_span] span: Span, /// A doc comment arg: NotIntoDiagnosticArg, + //~^ ERROR the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied } diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr index 27044748d080..e4b8958b4fae 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive-doc-comment-field.stderr @@ -1,42 +1,29 @@ error[E0277]: the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied - --> $DIR/diagnostic-derive-doc-comment-field.rs:29:10 + --> $DIR/diagnostic-derive-doc-comment-field.rs:37:10 | LL | #[derive(Diagnostic)] - | ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` + | ---------- required by a bound introduced by this call +... +LL | arg: NotIntoDiagnosticArg, + | ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` | - = help: the following other types implement trait `IntoDiagnosticArg`: - &'a T - &'a std::path::Path - &'a str - &rustc_target::spec::TargetTriple - Box<(dyn std::error::Error + 'static)> - CString - CguReuse - Cow<'a, str> - and 42 others + = help: normalized in stderr note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` - --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:747:5 - = note: this error originates in the derive macro `Diagnostic` which comes from the expansion of the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC + = note: this error originates in the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `NotIntoDiagnosticArg: IntoDiagnosticArg` is not satisfied - --> $DIR/diagnostic-derive-doc-comment-field.rs:39:10 + --> $DIR/diagnostic-derive-doc-comment-field.rs:47:10 | LL | #[derive(Subdiagnostic)] - | ^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` + | ------------- required by a bound introduced by this call +... +LL | arg: NotIntoDiagnosticArg, + | ^^^^^^^^^^^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `NotIntoDiagnosticArg` | - = help: the following other types implement trait `IntoDiagnosticArg`: - &'a T - &'a std::path::Path - &'a str - &rustc_target::spec::TargetTriple - Box<(dyn std::error::Error + 'static)> - CString - CguReuse - Cow<'a, str> - and 42 others + = help: normalized in stderr note: required by a bound in `Diagnostic::set_arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic.rs:964:5 - = note: this error originates in the derive macro `Subdiagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 2 previous errors diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs index 80ab03ab24c8..39e34d73f9a4 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.rs @@ -339,12 +339,12 @@ struct ErrorWithDefaultLabelAttr<'a> { } #[derive(Diagnostic)] -//~^ ERROR the trait bound `Hello: IntoDiagnosticArg` is not satisfied #[diag(no_crate_example, code = "E0123")] struct ArgFieldWithoutSkip { #[primary_span] span: Span, other: Hello, + //~^ ERROR the trait bound `Hello: IntoDiagnosticArg` is not satisfied } #[derive(Diagnostic)] diff --git a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr index 5e1bea4e38cc..801e4b5793cc 100644 --- a/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr +++ b/tests/ui-fulldeps/session-diagnostic/diagnostic-derive.stderr @@ -641,15 +641,18 @@ LL | #[derive(Diagnostic)] = note: this error originates in the derive macro `Diagnostic` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Hello: IntoDiagnosticArg` is not satisfied - --> $DIR/diagnostic-derive.rs:341:10 + --> $DIR/diagnostic-derive.rs:346:12 | LL | #[derive(Diagnostic)] - | ^^^^^^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` + | ---------- required by a bound introduced by this call +... +LL | other: Hello, + | ^^^^^ the trait `IntoDiagnosticArg` is not implemented for `Hello` | = help: normalized in stderr note: required by a bound in `DiagnosticBuilder::<'a, G>::set_arg` --> $COMPILER_DIR/rustc_errors/src/diagnostic_builder.rs:LL:CC - = note: this error originates in the derive macro `Diagnostic` which comes from the expansion of the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `forward` (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to 84 previous errors From a9051d861ca13a1c16da3cd4248b26d86cf5e1d5 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 18 Apr 2023 19:44:27 +0000 Subject: [PATCH 71/97] Tweak borrow suggestion --- compiler/rustc_hir_typeck/src/demand.rs | 81 ++++++------ .../argument-suggestions/issue-97484.stderr | 2 +- .../ui/async-await/issues/issue-102206.stderr | 10 +- tests/ui/coercion/coercion-slice.stderr | 11 +- tests/ui/inference/deref-suggestion.stderr | 20 +-- tests/ui/issues/issue-11374.stderr | 10 +- tests/ui/issues/issue-17033.stderr | 11 +- tests/ui/issues/issue-18819.stderr | 2 +- tests/ui/issues/issue-46302.stderr | 10 +- tests/ui/issues/issue-61106.stderr | 10 +- tests/ui/methods/method-self-arg-1.stderr | 10 +- .../dont-point-return-on-E0308.stderr | 10 +- tests/ui/mut/mut-cross-borrowing.stderr | 10 +- tests/ui/range/issue-54505-no-literals.fixed | 24 ++-- tests/ui/range/issue-54505-no-literals.rs | 24 ++-- tests/ui/range/issue-54505-no-literals.stderr | 120 +++++++++++------- tests/ui/span/coerce-suggestions.stderr | 11 +- tests/ui/span/issue-39018.stderr | 10 +- tests/ui/str/str-array-assignment.stderr | 21 +-- tests/ui/suggestions/suggest-ref-macro.rs | 4 +- tests/ui/suggestions/suggest-ref-macro.stderr | 19 +-- tests/ui/type/type-mismatch.stderr | 20 +-- .../ui/typeck/bad-index-due-to-nested.stderr | 18 +-- .../ui/typeck/bad-type-in-vec-contains.stderr | 10 +- tests/ui/typeck/issue-13853.stderr | 10 +- tests/ui/unsized-locals/suggest-borrow.stderr | 11 +- 26 files changed, 288 insertions(+), 211 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index ee81ea345a64..b8de22272ddb 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -1334,52 +1334,55 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { )); } - if let Ok(src) = sm.span_to_snippet(sugg_sp) { - let needs_parens = match expr.kind { - // parenthesize if needed (Issue #46756) - hir::ExprKind::Cast(_, _) | hir::ExprKind::Binary(_, _, _) => true, - // parenthesize borrows of range literals (Issue #54505) - _ if is_range_literal(expr) => true, - _ => false, - }; + let needs_parens = match expr.kind { + // parenthesize if needed (Issue #46756) + hir::ExprKind::Cast(_, _) | hir::ExprKind::Binary(_, _, _) => true, + // parenthesize borrows of range literals (Issue #54505) + _ if is_range_literal(expr) => true, + _ => false, + }; - if let Some(sugg) = self.can_use_as_ref(expr) { - return Some(( - sugg.0, - sugg.1.to_string(), - sugg.2, - Applicability::MachineApplicable, - false, - false, - )); - } - - let prefix = match self.maybe_get_struct_pattern_shorthand_field(expr) { - Some(ident) => format!("{ident}: "), - None => String::new(), - }; - - if let Some(hir::Node::Expr(hir::Expr { - kind: hir::ExprKind::Assign(..), - .. - })) = self.tcx.hir().find_parent(expr.hir_id) - { - if mutability.is_mut() { - // Suppressing this diagnostic, we'll properly print it in `check_expr_assign` - return None; - } - } - - let sugg_expr = if needs_parens { format!("({src})") } else { src }; + if let Some(sugg) = self.can_use_as_ref(expr) { return Some(( - sp, - format!("consider {}borrowing here", mutability.mutably_str()), - format!("{prefix}{}{sugg_expr}", mutability.ref_prefix_str()), + sugg.0, + sugg.1.to_string(), + sugg.2, Applicability::MachineApplicable, false, false, )); } + + let prefix = match self.maybe_get_struct_pattern_shorthand_field(expr) { + Some(ident) => format!("{ident}: "), + None => String::new(), + }; + + if let Some(hir::Node::Expr(hir::Expr { + kind: hir::ExprKind::Assign(..), + .. + })) = self.tcx.hir().find_parent(expr.hir_id) + { + if mutability.is_mut() { + // Suppressing this diagnostic, we'll properly print it in `check_expr_assign` + return None; + } + } + + let (sp, sugg_expr, verbose) = if needs_parens { + let src = sm.span_to_snippet(sugg_sp).ok()?; + (sp, format!("({src})"), false) + } else { + (sp.shrink_to_lo(), "".to_string(), true) + }; + return Some(( + sp, + format!("consider {}borrowing here", mutability.mutably_str()), + format!("{prefix}{}{sugg_expr}", mutability.ref_prefix_str()), + Applicability::MachineApplicable, + verbose, + false, + )); } } ( diff --git a/tests/ui/argument-suggestions/issue-97484.stderr b/tests/ui/argument-suggestions/issue-97484.stderr index a86cbbf1802e..082564fbc7f8 100644 --- a/tests/ui/argument-suggestions/issue-97484.stderr +++ b/tests/ui/argument-suggestions/issue-97484.stderr @@ -16,7 +16,7 @@ LL | fn foo(a: &A, d: D, e: &E, g: G) {} help: consider borrowing here | LL | foo(&&A, B, C, D, &E, F, G); - | ~~ + | + help: remove the extra arguments | LL - foo(&&A, B, C, D, E, F, G); diff --git a/tests/ui/async-await/issues/issue-102206.stderr b/tests/ui/async-await/issues/issue-102206.stderr index 750b7a886ef9..cd8450568051 100644 --- a/tests/ui/async-await/issues/issue-102206.stderr +++ b/tests/ui/async-await/issues/issue-102206.stderr @@ -2,14 +2,16 @@ error[E0308]: mismatched types --> $DIR/issue-102206.rs:6:27 | LL | std::mem::size_of_val(foo()); - | --------------------- ^^^^^ - | | | - | | expected `&_`, found future - | | help: consider borrowing here: `&foo()` + | --------------------- ^^^^^ expected `&_`, found future + | | | arguments to this function are incorrect | note: function defined here --> $SRC_DIR/core/src/mem/mod.rs:LL:COL +help: consider borrowing here + | +LL | std::mem::size_of_val(&foo()); + | + error: aborting due to previous error diff --git a/tests/ui/coercion/coercion-slice.stderr b/tests/ui/coercion/coercion-slice.stderr index c7b856a57ebc..17bbca7a0bdb 100644 --- a/tests/ui/coercion/coercion-slice.stderr +++ b/tests/ui/coercion/coercion-slice.stderr @@ -2,11 +2,14 @@ error[E0308]: mismatched types --> $DIR/coercion-slice.rs:4:21 | LL | let _: &[i32] = [0]; - | ------ ^^^ - | | | - | | expected `&[i32]`, found `[{integer}; 1]` - | | help: consider borrowing here: `&[0]` + | ------ ^^^ expected `&[i32]`, found `[{integer}; 1]` + | | | expected due to this + | +help: consider borrowing here + | +LL | let _: &[i32] = &[0]; + | + error: aborting due to previous error diff --git a/tests/ui/inference/deref-suggestion.stderr b/tests/ui/inference/deref-suggestion.stderr index 6f5aacacfc1f..c58aab422698 100644 --- a/tests/ui/inference/deref-suggestion.stderr +++ b/tests/ui/inference/deref-suggestion.stderr @@ -98,19 +98,23 @@ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:40:17 | LL | let s = S { u }; - | ^ - | | - | expected `&u32`, found integer - | help: consider borrowing here: `u: &u` + | ^ expected `&u32`, found integer + | +help: consider borrowing here + | +LL | let s = S { u: &u }; + | ++++ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:42:20 | LL | let s = S { u: u }; - | ^ - | | - | expected `&u32`, found integer - | help: consider borrowing here: `&u` + | ^ expected `&u32`, found integer + | +help: consider borrowing here + | +LL | let s = S { u: &u }; + | + error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:45:17 diff --git a/tests/ui/issues/issue-11374.stderr b/tests/ui/issues/issue-11374.stderr index 6e1fb1540bb1..879dc5b76c59 100644 --- a/tests/ui/issues/issue-11374.stderr +++ b/tests/ui/issues/issue-11374.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-11374.rs:26:15 | LL | c.read_to(v); - | ------- ^ - | | | - | | expected `&mut [u8]`, found `Vec<_>` - | | help: consider mutably borrowing here: `&mut v` + | ------- ^ expected `&mut [u8]`, found `Vec<_>` + | | | arguments to this method are incorrect | = note: expected mutable reference `&mut [u8]` @@ -15,6 +13,10 @@ note: method defined here | LL | pub fn read_to(&mut self, vec: &mut [u8]) { | ^^^^^^^ -------------- +help: consider mutably borrowing here + | +LL | c.read_to(&mut v); + | ++++ error: aborting due to previous error diff --git a/tests/ui/issues/issue-17033.stderr b/tests/ui/issues/issue-17033.stderr index f26bee5ff45d..3419c0798595 100644 --- a/tests/ui/issues/issue-17033.stderr +++ b/tests/ui/issues/issue-17033.stderr @@ -2,11 +2,14 @@ error[E0308]: mismatched types --> $DIR/issue-17033.rs:2:10 | LL | (*p)(()) - | ---- ^^ - | | | - | | expected `&mut ()`, found `()` - | | help: consider mutably borrowing here: `&mut ()` + | ---- ^^ expected `&mut ()`, found `()` + | | | arguments to this function are incorrect + | +help: consider mutably borrowing here + | +LL | (*p)(&mut ()) + | ++++ error: aborting due to previous error diff --git a/tests/ui/issues/issue-18819.stderr b/tests/ui/issues/issue-18819.stderr index 1fc974b609c1..40098f9622fa 100644 --- a/tests/ui/issues/issue-18819.stderr +++ b/tests/ui/issues/issue-18819.stderr @@ -19,7 +19,7 @@ LL | fn print_x(_: &dyn Foo, extra: &str) { help: consider borrowing here | LL | print_x(&X); - | ~~ + | + help: provide the argument | LL | print_x(/* &dyn Foo */, /* &str */); diff --git a/tests/ui/issues/issue-46302.stderr b/tests/ui/issues/issue-46302.stderr index a6f97c3c9af6..6e126038cc95 100644 --- a/tests/ui/issues/issue-46302.stderr +++ b/tests/ui/issues/issue-46302.stderr @@ -2,10 +2,12 @@ error[E0308]: mismatched types --> $DIR/issue-46302.rs:3:27 | LL | let u: &str = if true { s[..2] } else { s }; - | ^^^^^^ - | | - | expected `&str`, found `str` - | help: consider borrowing here: `&s[..2]` + | ^^^^^^ expected `&str`, found `str` + | +help: consider borrowing here + | +LL | let u: &str = if true { &s[..2] } else { s }; + | + error: aborting due to previous error diff --git a/tests/ui/issues/issue-61106.stderr b/tests/ui/issues/issue-61106.stderr index eff3e6e78495..aa922e2682d8 100644 --- a/tests/ui/issues/issue-61106.stderr +++ b/tests/ui/issues/issue-61106.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-61106.rs:3:9 | LL | foo(x.clone()); - | --- ^^^^^^^^^ - | | | - | | expected `&str`, found `String` - | | help: consider borrowing here: `&x` + | --- ^^^^^^^^^ expected `&str`, found `String` + | | | arguments to this function are incorrect | note: function defined here @@ -13,6 +11,10 @@ note: function defined here | LL | fn foo(_: &str) {} | ^^^ ------- +help: consider borrowing here + | +LL | foo(&x.clone()); + | + error: aborting due to previous error diff --git a/tests/ui/methods/method-self-arg-1.stderr b/tests/ui/methods/method-self-arg-1.stderr index 9241a8be58f2..dcc21acc5c0f 100644 --- a/tests/ui/methods/method-self-arg-1.stderr +++ b/tests/ui/methods/method-self-arg-1.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/method-self-arg-1.rs:11:14 | LL | Foo::bar(x); - | -------- ^ - | | | - | | expected `&Foo`, found `Foo` - | | help: consider borrowing here: `&x` + | -------- ^ expected `&Foo`, found `Foo` + | | | arguments to this function are incorrect | note: method defined here @@ -13,6 +11,10 @@ note: method defined here | LL | fn bar(&self) {} | ^^^ ----- +help: consider borrowing here + | +LL | Foo::bar(&x); + | + error[E0308]: mismatched types --> $DIR/method-self-arg-1.rs:13:14 diff --git a/tests/ui/mismatched_types/dont-point-return-on-E0308.stderr b/tests/ui/mismatched_types/dont-point-return-on-E0308.stderr index 13942682d289..7be94ef4ad66 100644 --- a/tests/ui/mismatched_types/dont-point-return-on-E0308.stderr +++ b/tests/ui/mismatched_types/dont-point-return-on-E0308.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/dont-point-return-on-E0308.rs:11:11 | LL | f(()); - | - ^^ - | | | - | | expected `&()`, found `()` - | | help: consider borrowing here: `&()` + | - ^^ expected `&()`, found `()` + | | | arguments to this function are incorrect | note: function defined here @@ -13,6 +11,10 @@ note: function defined here | LL | async fn f(_: &()) {} | ^ ------ +help: consider borrowing here + | +LL | f(&()); + | + error: aborting due to previous error diff --git a/tests/ui/mut/mut-cross-borrowing.stderr b/tests/ui/mut/mut-cross-borrowing.stderr index 8401827e51f8..8a3076db9b23 100644 --- a/tests/ui/mut/mut-cross-borrowing.stderr +++ b/tests/ui/mut/mut-cross-borrowing.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/mut-cross-borrowing.rs:7:7 | LL | f(x) - | - ^ - | | | - | | expected `&mut isize`, found `Box<{integer}>` - | | help: consider mutably borrowing here: `&mut x` + | - ^ expected `&mut isize`, found `Box<{integer}>` + | | | arguments to this function are incorrect | = note: expected mutable reference `&mut isize` @@ -15,6 +13,10 @@ note: function defined here | LL | fn f(_: &mut isize) {} | ^ ------------- +help: consider mutably borrowing here + | +LL | f(&mut x) + | ++++ error: aborting due to previous error diff --git a/tests/ui/range/issue-54505-no-literals.fixed b/tests/ui/range/issue-54505-no-literals.fixed index 4d8f67182b9a..71c36c741cc5 100644 --- a/tests/ui/range/issue-54505-no-literals.fixed +++ b/tests/ui/range/issue-54505-no-literals.fixed @@ -16,60 +16,60 @@ fn main() { take_range(&std::ops::Range { start: 0, end: 1 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::Range { start: 0, end: 1 } + //~| SUGGESTION & take_range(&::std::ops::Range { start: 0, end: 1 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::Range { start: 0, end: 1 } + //~| SUGGESTION & take_range(&std::ops::RangeFrom { start: 1 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeFrom { start: 1 } + //~| SUGGESTION & take_range(&::std::ops::RangeFrom { start: 1 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeFrom { start: 1 } + //~| SUGGESTION & take_range(&std::ops::RangeFull {}); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeFull {} + //~| SUGGESTION & take_range(&::std::ops::RangeFull {}); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeFull {} + //~| SUGGESTION & take_range(&std::ops::RangeInclusive::new(0, 1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeInclusive::new(0, 1) + //~| SUGGESTION & take_range(&::std::ops::RangeInclusive::new(0, 1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeInclusive::new(0, 1) + //~| SUGGESTION & take_range(&std::ops::RangeTo { end: 5 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeTo { end: 5 } + //~| SUGGESTION & take_range(&::std::ops::RangeTo { end: 5 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeTo { end: 5 } + //~| SUGGESTION & take_range(&std::ops::RangeToInclusive { end: 5 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeToInclusive { end: 5 } + //~| SUGGESTION & take_range(&::std::ops::RangeToInclusive { end: 5 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeToInclusive { end: 5 } + //~| SUGGESTION & } diff --git a/tests/ui/range/issue-54505-no-literals.rs b/tests/ui/range/issue-54505-no-literals.rs index dc21dcbc2db4..db125d1a22b6 100644 --- a/tests/ui/range/issue-54505-no-literals.rs +++ b/tests/ui/range/issue-54505-no-literals.rs @@ -16,60 +16,60 @@ fn main() { take_range(std::ops::Range { start: 0, end: 1 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::Range { start: 0, end: 1 } + //~| SUGGESTION & take_range(::std::ops::Range { start: 0, end: 1 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::Range { start: 0, end: 1 } + //~| SUGGESTION & take_range(std::ops::RangeFrom { start: 1 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeFrom { start: 1 } + //~| SUGGESTION & take_range(::std::ops::RangeFrom { start: 1 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeFrom { start: 1 } + //~| SUGGESTION & take_range(std::ops::RangeFull {}); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeFull {} + //~| SUGGESTION & take_range(::std::ops::RangeFull {}); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeFull {} + //~| SUGGESTION & take_range(std::ops::RangeInclusive::new(0, 1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeInclusive::new(0, 1) + //~| SUGGESTION & take_range(::std::ops::RangeInclusive::new(0, 1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeInclusive::new(0, 1) + //~| SUGGESTION & take_range(std::ops::RangeTo { end: 5 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeTo { end: 5 } + //~| SUGGESTION & take_range(::std::ops::RangeTo { end: 5 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeTo { end: 5 } + //~| SUGGESTION & take_range(std::ops::RangeToInclusive { end: 5 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &std::ops::RangeToInclusive { end: 5 } + //~| SUGGESTION & take_range(::std::ops::RangeToInclusive { end: 5 }); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &::std::ops::RangeToInclusive { end: 5 } + //~| SUGGESTION & } diff --git a/tests/ui/range/issue-54505-no-literals.stderr b/tests/ui/range/issue-54505-no-literals.stderr index d112983848de..5894bb6ba553 100644 --- a/tests/ui/range/issue-54505-no-literals.stderr +++ b/tests/ui/range/issue-54505-no-literals.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:16:16 | LL | take_range(std::ops::Range { start: 0, end: 1 }); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `Range<{integer}>` - | | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `Range<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -15,15 +13,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&std::ops::Range { start: 0, end: 1 }); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:21:16 | LL | take_range(::std::ops::Range { start: 0, end: 1 }); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `Range<{integer}>` - | | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `Range<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -33,15 +33,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&::std::ops::Range { start: 0, end: 1 }); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:26:16 | LL | take_range(std::ops::RangeFrom { start: 1 }); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeFrom<{integer}>` - | | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeFrom<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -51,15 +53,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&std::ops::RangeFrom { start: 1 }); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:31:16 | LL | take_range(::std::ops::RangeFrom { start: 1 }); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeFrom<{integer}>` - | | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeFrom<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -69,15 +73,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&::std::ops::RangeFrom { start: 1 }); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:36:16 | LL | take_range(std::ops::RangeFull {}); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeFull` - | | help: consider borrowing here: `&std::ops::RangeFull {}` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeFull` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -87,15 +93,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&std::ops::RangeFull {}); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:41:16 | LL | take_range(::std::ops::RangeFull {}); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeFull` - | | help: consider borrowing here: `&::std::ops::RangeFull {}` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeFull` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -105,15 +113,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&::std::ops::RangeFull {}); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:46:16 | LL | take_range(std::ops::RangeInclusive::new(0, 1)); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeInclusive<{integer}>` - | | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeInclusive<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -123,15 +133,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&std::ops::RangeInclusive::new(0, 1)); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:51:16 | LL | take_range(::std::ops::RangeInclusive::new(0, 1)); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeInclusive<{integer}>` - | | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeInclusive<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -141,15 +153,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&::std::ops::RangeInclusive::new(0, 1)); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:56:16 | LL | take_range(std::ops::RangeTo { end: 5 }); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeTo<{integer}>` - | | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeTo<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -159,15 +173,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&std::ops::RangeTo { end: 5 }); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:61:16 | LL | take_range(::std::ops::RangeTo { end: 5 }); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeTo<{integer}>` - | | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeTo<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -177,15 +193,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&::std::ops::RangeTo { end: 5 }); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:66:16 | LL | take_range(std::ops::RangeToInclusive { end: 5 }); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeToInclusive<{integer}>` - | | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -195,15 +213,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&std::ops::RangeToInclusive { end: 5 }); + | + error[E0308]: mismatched types --> $DIR/issue-54505-no-literals.rs:71:16 | LL | take_range(::std::ops::RangeToInclusive { end: 5 }); - | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | | - | | expected `&_`, found `RangeToInclusive<{integer}>` - | | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }` + | ---------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -213,6 +233,10 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&::std::ops::RangeToInclusive { end: 5 }); + | + error: aborting due to 12 previous errors diff --git a/tests/ui/span/coerce-suggestions.stderr b/tests/ui/span/coerce-suggestions.stderr index bb30f000ea7e..ff840b781f07 100644 --- a/tests/ui/span/coerce-suggestions.stderr +++ b/tests/ui/span/coerce-suggestions.stderr @@ -10,11 +10,14 @@ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:9:19 | LL | let x: &str = String::new(); - | ---- ^^^^^^^^^^^^^ - | | | - | | expected `&str`, found `String` - | | help: consider borrowing here: `&String::new()` + | ---- ^^^^^^^^^^^^^ expected `&str`, found `String` + | | | expected due to this + | +help: consider borrowing here + | +LL | let x: &str = &String::new(); + | + error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:12:10 diff --git a/tests/ui/span/issue-39018.stderr b/tests/ui/span/issue-39018.stderr index bae936392717..c8c4a5139880 100644 --- a/tests/ui/span/issue-39018.stderr +++ b/tests/ui/span/issue-39018.stderr @@ -78,10 +78,12 @@ error[E0308]: mismatched types --> $DIR/issue-39018.rs:29:17 | LL | let _ = a + b; - | ^ - | | - | expected `&str`, found `String` - | help: consider borrowing here: `&b` + | ^ expected `&str`, found `String` + | +help: consider borrowing here + | +LL | let _ = a + &b; + | + error[E0369]: cannot add `String` to `&String` --> $DIR/issue-39018.rs:30:15 diff --git a/tests/ui/str/str-array-assignment.stderr b/tests/ui/str/str-array-assignment.stderr index c23400a1d14a..515cb9e12f85 100644 --- a/tests/ui/str/str-array-assignment.stderr +++ b/tests/ui/str/str-array-assignment.stderr @@ -10,10 +10,12 @@ error[E0308]: mismatched types --> $DIR/str-array-assignment.rs:5:27 | LL | let u: &str = if true { s[..2] } else { s }; - | ^^^^^^ - | | - | expected `&str`, found `str` - | help: consider borrowing here: `&s[..2]` + | ^^^^^^ expected `&str`, found `str` + | +help: consider borrowing here + | +LL | let u: &str = if true { &s[..2] } else { s }; + | + error[E0277]: the size for values of type `str` cannot be known at compilation time --> $DIR/str-array-assignment.rs:7:7 @@ -33,11 +35,14 @@ error[E0308]: mismatched types --> $DIR/str-array-assignment.rs:9:17 | LL | let w: &str = s[..2]; - | ---- ^^^^^^ - | | | - | | expected `&str`, found `str` - | | help: consider borrowing here: `&s[..2]` + | ---- ^^^^^^ expected `&str`, found `str` + | | | expected due to this + | +help: consider borrowing here + | +LL | let w: &str = &s[..2]; + | + error: aborting due to 4 previous errors diff --git a/tests/ui/suggestions/suggest-ref-macro.rs b/tests/ui/suggestions/suggest-ref-macro.rs index 6f780f32a147..730f5fa1b5e3 100644 --- a/tests/ui/suggestions/suggest-ref-macro.rs +++ b/tests/ui/suggestions/suggest-ref-macro.rs @@ -14,7 +14,7 @@ macro_rules! bla { () => { x(123); //~^ ERROR mismatched types - //~| SUGGESTION &mut 123 + //~| SUGGESTION &mut }; ($v:expr) => { x($v) @@ -25,5 +25,5 @@ fn main() { bla!(); bla!(456); //~^ ERROR mismatched types - //~| SUGGESTION &mut 456 + //~| SUGGESTION &mut } diff --git a/tests/ui/suggestions/suggest-ref-macro.stderr b/tests/ui/suggestions/suggest-ref-macro.stderr index 17de49fbd841..08bc9e86a50f 100644 --- a/tests/ui/suggestions/suggest-ref-macro.stderr +++ b/tests/ui/suggestions/suggest-ref-macro.stderr @@ -18,10 +18,8 @@ error[E0308]: mismatched types --> $DIR/suggest-ref-macro.rs:15:11 | LL | x(123); - | - ^^^ - | | | - | | expected `&mut i32`, found integer - | | help: consider mutably borrowing here: `&mut 123` + | - ^^^ expected `&mut i32`, found integer + | | | arguments to this function are incorrect ... LL | bla!(); @@ -33,6 +31,10 @@ note: function defined here LL | fn x(_: &mut i32) {} | ^ ----------- = note: this error originates in the macro `bla` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider mutably borrowing here + | +LL | x(&mut 123); + | ++++ error[E0308]: mismatched types --> $DIR/suggest-ref-macro.rs:26:10 @@ -41,16 +43,17 @@ LL | x($v) | - arguments to this function are incorrect ... LL | bla!(456); - | ^^^ - | | - | expected `&mut i32`, found integer - | help: consider mutably borrowing here: `&mut 456` + | ^^^ expected `&mut i32`, found integer | note: function defined here --> $DIR/suggest-ref-macro.rs:11:4 | LL | fn x(_: &mut i32) {} | ^ ----------- +help: consider mutably borrowing here + | +LL | bla!(&mut 456); + | ++++ error: aborting due to 3 previous errors diff --git a/tests/ui/type/type-mismatch.stderr b/tests/ui/type/type-mismatch.stderr index 67a1f893050c..ce6f29d354fd 100644 --- a/tests/ui/type/type-mismatch.stderr +++ b/tests/ui/type/type-mismatch.stderr @@ -378,10 +378,8 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:47:23 | LL | want::<&Foo>(f); - | ----------------- ^ - | | | - | | expected `&Foo`, found `Foo` - | | help: consider borrowing here: `&f` + | ----------------- ^ expected `&Foo`, found `Foo` + | | | arguments to this function are incorrect | = note: expected reference `&Foo` @@ -391,6 +389,10 @@ note: function defined here | LL | fn want(t: T) {} | ^^^^ ---- +help: consider borrowing here + | +LL | want::<&Foo>(&f); + | + error[E0308]: mismatched types --> $DIR/type-mismatch.rs:48:26 @@ -556,10 +558,8 @@ error[E0308]: mismatched types --> $DIR/type-mismatch.rs:61:26 | LL | want::<&Foo>(f); - | -------------------- ^ - | | | - | | expected `&Foo`, found `Foo` - | | help: consider borrowing here: `&f` + | -------------------- ^ expected `&Foo`, found `Foo` + | | | arguments to this function are incorrect | = note: expected reference `&Foo` @@ -569,6 +569,10 @@ note: function defined here | LL | fn want(t: T) {} | ^^^^ ---- +help: consider borrowing here + | +LL | want::<&Foo>(&f); + | + error[E0308]: mismatched types --> $DIR/type-mismatch.rs:65:19 diff --git a/tests/ui/typeck/bad-index-due-to-nested.stderr b/tests/ui/typeck/bad-index-due-to-nested.stderr index cdb23372c4ba..f9cdb280e276 100644 --- a/tests/ui/typeck/bad-index-due-to-nested.stderr +++ b/tests/ui/typeck/bad-index-due-to-nested.stderr @@ -42,13 +42,14 @@ error[E0308]: mismatched types LL | fn index<'a, K, V>(map: &'a HashMap, k: K) -> &'a V { | - this type parameter LL | map[k] - | ^ - | | - | expected `&K`, found type parameter `K` - | help: consider borrowing here: `&k` + | ^ expected `&K`, found type parameter `K` | = note: expected reference `&K` found type parameter `K` +help: consider borrowing here + | +LL | map[&k] + | + error[E0308]: mismatched types --> $DIR/bad-index-due-to-nested.rs:20:5 @@ -56,13 +57,14 @@ error[E0308]: mismatched types LL | fn index<'a, K, V>(map: &'a HashMap, k: K) -> &'a V { | - this type parameter ----- expected `&'a V` because of return type LL | map[k] - | ^^^^^^ - | | - | expected `&V`, found type parameter `V` - | help: consider borrowing here: `&map[k]` + | ^^^^^^ expected `&V`, found type parameter `V` | = note: expected reference `&'a V` found type parameter `V` +help: consider borrowing here + | +LL | &map[k] + | + error: aborting due to 4 previous errors diff --git a/tests/ui/typeck/bad-type-in-vec-contains.stderr b/tests/ui/typeck/bad-type-in-vec-contains.stderr index 72533ab1fa37..b9b3a5fe5ec8 100644 --- a/tests/ui/typeck/bad-type-in-vec-contains.stderr +++ b/tests/ui/typeck/bad-type-in-vec-contains.stderr @@ -2,16 +2,18 @@ error[E0308]: mismatched types --> $DIR/bad-type-in-vec-contains.rs:5:21 | LL | primes.contains(3); - | -------- ^ - | | | - | | expected `&_`, found integer - | | help: consider borrowing here: `&3` + | -------- ^ expected `&_`, found integer + | | | arguments to this method are incorrect | = note: expected reference `&_` found type `{integer}` note: method defined here --> $SRC_DIR/core/src/slice/mod.rs:LL:COL +help: consider borrowing here + | +LL | primes.contains(&3); + | + error: aborting due to previous error diff --git a/tests/ui/typeck/issue-13853.stderr b/tests/ui/typeck/issue-13853.stderr index 11d34f5b93b0..8ecb8b680160 100644 --- a/tests/ui/typeck/issue-13853.stderr +++ b/tests/ui/typeck/issue-13853.stderr @@ -20,10 +20,8 @@ error[E0308]: mismatched types --> $DIR/issue-13853.rs:37:13 | LL | iterate(graph); - | ------- ^^^^^ - | | | - | | expected `&_`, found `Vec` - | | help: consider borrowing here: `&graph` + | ------- ^^^^^ expected `&_`, found `Vec` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -33,6 +31,10 @@ note: function defined here | LL | fn iterate>(graph: &G) { | ^^^^^^^ --------- +help: consider borrowing here + | +LL | iterate(&graph); + | + error: aborting due to 3 previous errors diff --git a/tests/ui/unsized-locals/suggest-borrow.stderr b/tests/ui/unsized-locals/suggest-borrow.stderr index d456c16de0dc..8741b35cdcff 100644 --- a/tests/ui/unsized-locals/suggest-borrow.stderr +++ b/tests/ui/unsized-locals/suggest-borrow.stderr @@ -16,11 +16,14 @@ error[E0308]: mismatched types --> $DIR/suggest-borrow.rs:3:20 | LL | let x: &[u8] = vec!(1, 2, 3)[..]; - | ----- ^^^^^^^^^^^^^^^^^ - | | | - | | expected `&[u8]`, found `[{integer}]` - | | help: consider borrowing here: `&vec!(1, 2, 3)[..]` + | ----- ^^^^^^^^^^^^^^^^^ expected `&[u8]`, found `[{integer}]` + | | | expected due to this + | +help: consider borrowing here + | +LL | let x: &[u8] = &vec!(1, 2, 3)[..]; + | + error[E0308]: mismatched types --> $DIR/suggest-borrow.rs:4:19 From a283f581839e17a3be4a828c95fa9e905e878ac4 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 18 Apr 2023 19:51:33 +0000 Subject: [PATCH 72/97] Rename some suggestion/note functions We really shouldn't be naming functions `fn check_*` unless they're doing *typechecking*. It's especially misleading when we're doing this inside of HIR typeck. --- compiler/rustc_hir_typeck/src/demand.rs | 16 ++++++++-------- .../rustc_hir_typeck/src/fn_ctxt/suggestions.rs | 4 ++-- compiler/rustc_hir_typeck/src/method/suggest.rs | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index b8de22272ddb..447332be8991 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -86,9 +86,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.emit_type_mismatch_suggestions(err, expr, expr_ty, expected, expected_ty_expr, error); self.note_type_is_not_clone(err, expected, expr_ty, expr); self.note_internal_mutation_in_method(err, expr, Some(expected), expr_ty); - self.check_for_range_as_method_call(err, expr, expr_ty, expected); - self.check_for_binding_assigned_block_without_tail_expression(err, expr, expr_ty, expected); - self.check_wrong_return_type_due_to_generic_arg(err, expr, expr_ty); + self.suggest_method_call_on_range_literal(err, expr, expr_ty, expected); + self.suggest_return_binding_for_missing_tail_expr(err, expr, expr_ty, expected); + self.note_wrong_return_ty_due_to_generic_arg(err, expr, expr_ty); } /// Requires that the two types unify, and prints an error message if @@ -1217,7 +1217,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// In addition of this check, it also checks between references mutability state. If the /// expected is mutable but the provided isn't, maybe we could just say "Hey, try with /// `&mut`!". - pub fn check_ref( + pub fn suggest_deref_or_ref( &self, expr: &hir::Expr<'tcx>, checked_ty: Ty<'tcx>, @@ -1572,7 +1572,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { None } - pub fn check_for_cast( + pub fn suggest_cast( &self, err: &mut Diagnostic, expr: &hir::Expr<'_>, @@ -1939,7 +1939,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } /// Identify when the user has written `foo..bar()` instead of `foo.bar()`. - pub fn check_for_range_as_method_call( + pub fn suggest_method_call_on_range_literal( &self, err: &mut Diagnostic, expr: &hir::Expr<'tcx>, @@ -2008,7 +2008,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// Identify when the type error is because `()` is found in a binding that was assigned a /// block without a tail expression. - fn check_for_binding_assigned_block_without_tail_expression( + fn suggest_return_binding_for_missing_tail_expr( &self, err: &mut Diagnostic, expr: &hir::Expr<'_>, @@ -2050,7 +2050,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - fn check_wrong_return_type_due_to_generic_arg( + fn note_wrong_return_ty_due_to_generic_arg( &self, err: &mut Diagnostic, expr: &hir::Expr<'_>, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 8978139119c4..8818a67934ba 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -275,7 +275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ) -> bool { let expr = expr.peel_blocks(); if let Some((sp, msg, suggestion, applicability, verbose, annotation)) = - self.check_ref(expr, found, expected) + self.suggest_deref_or_ref(expr, found, expected) { if verbose { err.span_suggestion_verbose(sp, msg, suggestion, applicability); @@ -342,7 +342,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_label(sp, format!("{descr} `{name}` defined here")); } return true; - } else if self.check_for_cast(err, expr, found, expected, expected_ty_expr) { + } else if self.suggest_cast(err, expr, found, expected, expected_ty_expr) { return true; } else { let methods = self.get_conversion_methods(expr.span, expected, found, expr.hir_id); diff --git a/compiler/rustc_hir_typeck/src/method/suggest.rs b/compiler/rustc_hir_typeck/src/method/suggest.rs index 30f0978d190c..90653bcba708 100644 --- a/compiler/rustc_hir_typeck/src/method/suggest.rs +++ b/compiler/rustc_hir_typeck/src/method/suggest.rs @@ -1045,7 +1045,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ); } - self.check_for_inner_self(&mut err, source, rcvr_ty, item_name); + self.suggest_unwrapping_inner_self(&mut err, source, rcvr_ty, item_name); bound_spans.sort(); bound_spans.dedup(); @@ -1132,7 +1132,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - self.check_for_deref_method(&mut err, source, rcvr_ty, item_name, expected); + self.note_derefed_ty_has_method(&mut err, source, rcvr_ty, item_name, expected); return Some(err); } @@ -1805,7 +1805,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - fn check_for_inner_self( + fn suggest_unwrapping_inner_self( &self, err: &mut Diagnostic, source: SelfSource<'tcx>, @@ -2175,7 +2175,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - fn check_for_deref_method( + fn note_derefed_ty_has_method( &self, err: &mut Diagnostic, self_source: SelfSource<'tcx>, From 4731a25d2dbe84e711101f2cbb83b40fa96c7014 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Tue, 18 Apr 2023 23:45:49 +0000 Subject: [PATCH 73/97] Make suggest_deref_or_ref return a multipart suggestion --- compiler/rustc_hir_typeck/src/demand.rs | 121 +++++++++--------- .../src/fn_ctxt/suggestions.rs | 6 +- ...-consider-borrowing-cast-or-binexpr.stderr | 20 +-- tests/ui/range/issue-54505-no-std.rs | 12 +- tests/ui/range/issue-54505-no-std.stderr | 60 +++++---- tests/ui/range/issue-54505.fixed | 12 +- tests/ui/range/issue-54505.rs | 12 +- tests/ui/range/issue-54505.stderr | 60 +++++---- ...issue-73553-misinterp-range-literal.stderr | 20 +-- tests/ui/suggestions/as-ref.stderr | 88 ++++++++----- 10 files changed, 235 insertions(+), 176 deletions(-) diff --git a/compiler/rustc_hir_typeck/src/demand.rs b/compiler/rustc_hir_typeck/src/demand.rs index 447332be8991..51cdf64c6b91 100644 --- a/compiler/rustc_hir_typeck/src/demand.rs +++ b/compiler/rustc_hir_typeck/src/demand.rs @@ -1087,7 +1087,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// ```ignore (illustrative) /// opt.map(|param| { takes_ref(param) }); /// ``` - fn can_use_as_ref(&self, expr: &hir::Expr<'_>) -> Option<(Span, &'static str, String)> { + fn can_use_as_ref(&self, expr: &hir::Expr<'_>) -> Option<(Vec<(Span, String)>, &'static str)> { let hir::ExprKind::Path(hir::QPath::Resolved(_, ref path)) = expr.kind else { return None; }; @@ -1133,12 +1133,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } _ => false, }; - match (is_as_ref_able, self.sess().source_map().span_to_snippet(method_path.ident.span)) { - (true, Ok(src)) => { - let suggestion = format!("as_ref().{}", src); - Some((method_path.ident.span, "consider using `as_ref` instead", suggestion)) - } - _ => None, + if is_as_ref_able { + Some(( + vec![(method_path.ident.span.shrink_to_lo(), "as_ref().".to_string())], + "consider using `as_ref` instead", + )) + } else { + None } } @@ -1223,8 +1224,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { checked_ty: Ty<'tcx>, expected: Ty<'tcx>, ) -> Option<( - Span, - String, + Vec<(Span, String)>, String, Applicability, bool, /* verbose */ @@ -1254,30 +1254,28 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && let Ok(src) = sm.span_to_snippet(sp) && replace_prefix(&src, "b\"", "\"").is_some() { - let pos = sp.lo() + BytePos(1); - return Some(( - sp.with_hi(pos), - "consider removing the leading `b`".to_string(), - String::new(), - Applicability::MachineApplicable, - true, - false, - )); - } - } + let pos = sp.lo() + BytePos(1); + return Some(( + vec![(sp.with_hi(pos), String::new())], + "consider removing the leading `b`".to_string(), + Applicability::MachineApplicable, + true, + false, + )); + } + } (&ty::Array(arr, _) | &ty::Slice(arr), &ty::Str) if arr == self.tcx.types.u8 => { if let hir::ExprKind::Lit(_) = expr.kind && let Ok(src) = sm.span_to_snippet(sp) && replace_prefix(&src, "\"", "b\"").is_some() { - return Some(( - sp.shrink_to_lo(), - "consider adding a leading `b`".to_string(), - "b".to_string(), - Applicability::MachineApplicable, - true, - false, - )); + return Some(( + vec![(sp.shrink_to_lo(), "b".to_string())], + "consider adding a leading `b`".to_string(), + Applicability::MachineApplicable, + true, + false, + )); } } _ => {} @@ -1320,14 +1318,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } if let hir::ExprKind::Unary(hir::UnOp::Deref, ref inner) = expr.kind - && let Some(1) = self.deref_steps(expected, checked_ty) { + && let Some(1) = self.deref_steps(expected, checked_ty) + { // We have `*&T`, check if what was expected was `&T`. // If so, we may want to suggest removing a `*`. sugg_sp = sugg_sp.with_hi(inner.span.lo()); return Some(( - sugg_sp, + vec![(sugg_sp, String::new())], "consider removing deref here".to_string(), - "".to_string(), Applicability::MachineApplicable, true, false, @@ -1342,13 +1340,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { _ => false, }; - if let Some(sugg) = self.can_use_as_ref(expr) { + if let Some((sugg, msg)) = self.can_use_as_ref(expr) { return Some(( - sugg.0, - sugg.1.to_string(), - sugg.2, + sugg, + msg.to_string(), Applicability::MachineApplicable, - false, + true, false, )); } @@ -1369,16 +1366,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } } - let (sp, sugg_expr, verbose) = if needs_parens { - let src = sm.span_to_snippet(sugg_sp).ok()?; - (sp, format!("({src})"), false) + let sugg = mutability.ref_prefix_str(); + let (sugg, verbose) = if needs_parens { + ( + vec![ + (sp.shrink_to_lo(), format!("{prefix}{sugg}(")), + (sp.shrink_to_hi(), ")".to_string()), + ], + false, + ) } else { - (sp.shrink_to_lo(), "".to_string(), true) + (vec![(sp.shrink_to_lo(), format!("{prefix}{sugg}"))], true) }; return Some(( - sp, + sugg, format!("consider {}borrowing here", mutability.mutably_str()), - format!("{prefix}{}{sugg_expr}", mutability.ref_prefix_str()), Applicability::MachineApplicable, verbose, false, @@ -1404,23 +1406,19 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { && sm.is_span_accessible(call_span) { return Some(( - sp.with_hi(call_span.lo()), + vec![(sp.with_hi(call_span.lo()), String::new())], "consider removing the borrow".to_string(), - String::new(), Applicability::MachineApplicable, true, - true + true, )); } return None; } - if sp.contains(expr.span) - && sm.is_span_accessible(expr.span) - { + if sp.contains(expr.span) && sm.is_span_accessible(expr.span) { return Some(( - sp.with_hi(expr.span.lo()), + vec![(sp.with_hi(expr.span.lo()), String::new())], "consider removing the borrow".to_string(), - String::new(), Applicability::MachineApplicable, true, true, @@ -1444,23 +1442,30 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { let suggestion = replace_prefix(&src, old_prefix, &new_prefix).map(|_| { // skip `&` or `&mut ` if both mutabilities are mutable - let lo = sp.lo() + BytePos(min(old_prefix.len(), mutbl_b.ref_prefix_str().len()) as _); + let lo = sp.lo() + + BytePos(min(old_prefix.len(), mutbl_b.ref_prefix_str().len()) as _); // skip `&` or `&mut ` let hi = sp.lo() + BytePos(old_prefix.len() as _); let sp = sp.with_lo(lo).with_hi(hi); ( sp, - format!("{}{derefs}", if mutbl_a != mutbl_b { mutbl_b.prefix_str() } else { "" }), - if mutbl_b <= mutbl_a { Applicability::MachineApplicable } else { Applicability::MaybeIncorrect } + format!( + "{}{derefs}", + if mutbl_a != mutbl_b { mutbl_b.prefix_str() } else { "" } + ), + if mutbl_b <= mutbl_a { + Applicability::MachineApplicable + } else { + Applicability::MaybeIncorrect + }, ) }); if let Some((span, src, applicability)) = suggestion { return Some(( - span, + vec![(span, src)], "consider dereferencing".to_string(), - src, applicability, true, false, @@ -1489,9 +1494,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { // If we've reached our target type with just removing `&`, then just print now. if steps == 0 && !remove.trim().is_empty() { return Some(( - prefix_span, + vec![(prefix_span, String::new())], format!("consider removing the `{}`", remove.trim()), - String::new(), // Do not remove `&&` to get to bool, because it might be something like // { a } && b, which we have a separate fixup suggestion that is more // likely correct... @@ -1557,9 +1561,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { } return Some(( - span, + vec![(span, suggestion)], message, - suggestion, Applicability::MachineApplicable, true, false, diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs index 8818a67934ba..aea0e4a6b2b0 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs @@ -274,13 +274,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { expected_ty_expr: Option<&'tcx hir::Expr<'tcx>>, ) -> bool { let expr = expr.peel_blocks(); - if let Some((sp, msg, suggestion, applicability, verbose, annotation)) = + if let Some((suggestion, msg, applicability, verbose, annotation)) = self.suggest_deref_or_ref(expr, found, expected) { if verbose { - err.span_suggestion_verbose(sp, msg, suggestion, applicability); + err.multipart_suggestion_verbose(msg, suggestion, applicability); } else { - err.span_suggestion(sp, msg, suggestion, applicability); + err.multipart_suggestion(msg, suggestion, applicability); } if annotation { let suggest_annotation = match expr.peel_drop_temps().kind { diff --git a/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr index e874ded8ec54..211dd5128959 100644 --- a/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr +++ b/tests/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:12:42 | LL | light_flows_our_war_of_mocking_words(behold as usize); - | ------------------------------------ ^^^^^^^^^^^^^^^ - | | | - | | expected `&usize`, found `usize` - | | help: consider borrowing here: `&(behold as usize)` + | ------------------------------------ ^^^^^^^^^^^^^^^ expected `&usize`, found `usize` + | | | arguments to this function are incorrect | note: function defined here @@ -13,15 +11,17 @@ note: function defined here | LL | fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- +help: consider borrowing here + | +LL | light_flows_our_war_of_mocking_words(&(behold as usize)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:14:42 | LL | light_flows_our_war_of_mocking_words(with_tears + 4); - | ------------------------------------ ^^^^^^^^^^^^^^ - | | | - | | expected `&usize`, found `usize` - | | help: consider borrowing here: `&(with_tears + 4)` + | ------------------------------------ ^^^^^^^^^^^^^^ expected `&usize`, found `usize` + | | | arguments to this function are incorrect | note: function defined here @@ -29,6 +29,10 @@ note: function defined here | LL | fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- +help: consider borrowing here + | +LL | light_flows_our_war_of_mocking_words(&(with_tears + 4)); + | ++ + error: aborting due to 2 previous errors diff --git a/tests/ui/range/issue-54505-no-std.rs b/tests/ui/range/issue-54505-no-std.rs index 9f378b4836e4..db455fada3bd 100644 --- a/tests/ui/range/issue-54505-no-std.rs +++ b/tests/ui/range/issue-54505-no-std.rs @@ -29,30 +29,30 @@ fn main() { take_range(0..1); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(0..1) + //~| SUGGESTION &( take_range(1..); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(1..) + //~| SUGGESTION &( take_range(..); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..) + //~| SUGGESTION &( take_range(0..=1); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(0..=1) + //~| SUGGESTION &( take_range(..5); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..5) + //~| SUGGESTION &( take_range(..=42); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..=42) + //~| SUGGESTION &( } diff --git a/tests/ui/range/issue-54505-no-std.stderr b/tests/ui/range/issue-54505-no-std.stderr index a6a9f89da749..13563d1940cb 100644 --- a/tests/ui/range/issue-54505-no-std.stderr +++ b/tests/ui/range/issue-54505-no-std.stderr @@ -14,10 +14,8 @@ error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:29:16 | LL | take_range(0..1); - | ---------- ^^^^ - | | | - | | expected `&_`, found `Range<{integer}>` - | | help: consider borrowing here: `&(0..1)` + | ---------- ^^^^ expected `&_`, found `Range<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -27,15 +25,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(0..1)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:34:16 | LL | take_range(1..); - | ---------- ^^^ - | | | - | | expected `&_`, found `RangeFrom<{integer}>` - | | help: consider borrowing here: `&(1..)` + | ---------- ^^^ expected `&_`, found `RangeFrom<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -45,15 +45,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(1..)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:39:16 | LL | take_range(..); - | ---------- ^^ - | | | - | | expected `&_`, found `RangeFull` - | | help: consider borrowing here: `&(..)` + | ---------- ^^ expected `&_`, found `RangeFull` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -63,15 +65,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(..)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:44:16 | LL | take_range(0..=1); - | ---------- ^^^^^ - | | | - | | expected `&_`, found `RangeInclusive<{integer}>` - | | help: consider borrowing here: `&(0..=1)` + | ---------- ^^^^^ expected `&_`, found `RangeInclusive<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -81,15 +85,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(0..=1)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:49:16 | LL | take_range(..5); - | ---------- ^^^ - | | | - | | expected `&_`, found `RangeTo<{integer}>` - | | help: consider borrowing here: `&(..5)` + | ---------- ^^^ expected `&_`, found `RangeTo<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -99,15 +105,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(..5)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505-no-std.rs:54:16 | LL | take_range(..=42); - | ---------- ^^^^^ - | | | - | | expected `&_`, found `RangeToInclusive<{integer}>` - | | help: consider borrowing here: `&(..=42)` + | ---------- ^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -117,6 +125,10 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(..=42)); + | ++ + error: aborting due to 8 previous errors diff --git a/tests/ui/range/issue-54505.fixed b/tests/ui/range/issue-54505.fixed index f8298c0b5cef..9d113ba1d35c 100644 --- a/tests/ui/range/issue-54505.fixed +++ b/tests/ui/range/issue-54505.fixed @@ -14,30 +14,30 @@ fn main() { take_range(&(0..1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(0..1) + //~| SUGGESTION &( take_range(&(1..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(1..) + //~| SUGGESTION &( take_range(&(..)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..) + //~| SUGGESTION &( take_range(&(0..=1)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(0..=1) + //~| SUGGESTION &( take_range(&(..5)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..5) + //~| SUGGESTION &( take_range(&(..=42)); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..=42) + //~| SUGGESTION &( } diff --git a/tests/ui/range/issue-54505.rs b/tests/ui/range/issue-54505.rs index 03673252dd3b..c9929988fe53 100644 --- a/tests/ui/range/issue-54505.rs +++ b/tests/ui/range/issue-54505.rs @@ -14,30 +14,30 @@ fn main() { take_range(0..1); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(0..1) + //~| SUGGESTION &( take_range(1..); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(1..) + //~| SUGGESTION &( take_range(..); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..) + //~| SUGGESTION &( take_range(0..=1); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(0..=1) + //~| SUGGESTION &( take_range(..5); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..5) + //~| SUGGESTION &( take_range(..=42); //~^ ERROR mismatched types [E0308] //~| HELP consider borrowing here - //~| SUGGESTION &(..=42) + //~| SUGGESTION &( } diff --git a/tests/ui/range/issue-54505.stderr b/tests/ui/range/issue-54505.stderr index eda047b507a3..0e959fc05e27 100644 --- a/tests/ui/range/issue-54505.stderr +++ b/tests/ui/range/issue-54505.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-54505.rs:14:16 | LL | take_range(0..1); - | ---------- ^^^^ - | | | - | | expected `&_`, found `Range<{integer}>` - | | help: consider borrowing here: `&(0..1)` + | ---------- ^^^^ expected `&_`, found `Range<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -15,15 +13,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(0..1)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505.rs:19:16 | LL | take_range(1..); - | ---------- ^^^ - | | | - | | expected `&_`, found `RangeFrom<{integer}>` - | | help: consider borrowing here: `&(1..)` + | ---------- ^^^ expected `&_`, found `RangeFrom<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -33,15 +33,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(1..)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505.rs:24:16 | LL | take_range(..); - | ---------- ^^ - | | | - | | expected `&_`, found `RangeFull` - | | help: consider borrowing here: `&(..)` + | ---------- ^^ expected `&_`, found `RangeFull` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -51,15 +53,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(..)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505.rs:29:16 | LL | take_range(0..=1); - | ---------- ^^^^^ - | | | - | | expected `&_`, found `RangeInclusive<{integer}>` - | | help: consider borrowing here: `&(0..=1)` + | ---------- ^^^^^ expected `&_`, found `RangeInclusive<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -69,15 +73,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(0..=1)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505.rs:34:16 | LL | take_range(..5); - | ---------- ^^^ - | | | - | | expected `&_`, found `RangeTo<{integer}>` - | | help: consider borrowing here: `&(..5)` + | ---------- ^^^ expected `&_`, found `RangeTo<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -87,15 +93,17 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(..5)); + | ++ + error[E0308]: mismatched types --> $DIR/issue-54505.rs:39:16 | LL | take_range(..=42); - | ---------- ^^^^^ - | | | - | | expected `&_`, found `RangeToInclusive<{integer}>` - | | help: consider borrowing here: `&(..=42)` + | ---------- ^^^^^ expected `&_`, found `RangeToInclusive<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&_` @@ -105,6 +113,10 @@ note: function defined here | LL | fn take_range(_r: &impl RangeBounds) {} | ^^^^^^^^^^ ------------------------- +help: consider borrowing here + | +LL | take_range(&(..=42)); + | ++ + error: aborting due to 6 previous errors diff --git a/tests/ui/range/issue-73553-misinterp-range-literal.stderr b/tests/ui/range/issue-73553-misinterp-range-literal.stderr index 77595b3678eb..52efa241d0b1 100644 --- a/tests/ui/range/issue-73553-misinterp-range-literal.stderr +++ b/tests/ui/range/issue-73553-misinterp-range-literal.stderr @@ -2,10 +2,8 @@ error[E0308]: mismatched types --> $DIR/issue-73553-misinterp-range-literal.rs:12:10 | LL | demo(tell(1)..tell(10)); - | ---- ^^^^^^^^^^^^^^^^^ - | | | - | | expected `&Range`, found `Range` - | | help: consider borrowing here: `&(tell(1)..tell(10))` + | ---- ^^^^^^^^^^^^^^^^^ expected `&Range`, found `Range` + | | | arguments to this function are incorrect | = note: expected reference `&std::ops::Range` @@ -15,15 +13,17 @@ note: function defined here | LL | fn demo(r: &Range) { | ^^^^ --------- +help: consider borrowing here + | +LL | demo(&(tell(1)..tell(10))); + | ++ + error[E0308]: mismatched types --> $DIR/issue-73553-misinterp-range-literal.rs:14:10 | LL | demo(1..10); - | ---- ^^^^^ - | | | - | | expected `&Range`, found `Range<{integer}>` - | | help: consider borrowing here: `&(1..10)` + | ---- ^^^^^ expected `&Range`, found `Range<{integer}>` + | | | arguments to this function are incorrect | = note: expected reference `&std::ops::Range` @@ -33,6 +33,10 @@ note: function defined here | LL | fn demo(r: &Range) { | ^^^^ --------- +help: consider borrowing here + | +LL | demo(&(1..10)); + | ++ + error: aborting due to 2 previous errors diff --git a/tests/ui/suggestions/as-ref.stderr b/tests/ui/suggestions/as-ref.stderr index 0ee343ebf9f1..2147d2d92e38 100644 --- a/tests/ui/suggestions/as-ref.stderr +++ b/tests/ui/suggestions/as-ref.stderr @@ -2,61 +2,73 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:7:29 | LL | opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found `Foo` - | | | - | | arguments to this function are incorrect - | help: consider using `as_ref` instead: `as_ref().map` + | --------- ^^^ expected `&Foo`, found `Foo` + | | + | arguments to this function are incorrect | note: function defined here --> $DIR/as-ref.rs:3:4 | LL | fn takes_ref(_: &Foo) {} | ^^^^^^^^^ ------- +help: consider using `as_ref` instead + | +LL | opt.as_ref().map(|arg| takes_ref(arg)); + | +++++++++ error[E0308]: mismatched types --> $DIR/as-ref.rs:8:39 | LL | opt.and_then(|arg| Some(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found `Foo` - | | | - | | arguments to this function are incorrect - | help: consider using `as_ref` instead: `as_ref().and_then` + | --------- ^^^ expected `&Foo`, found `Foo` + | | + | arguments to this function are incorrect | note: function defined here --> $DIR/as-ref.rs:3:4 | LL | fn takes_ref(_: &Foo) {} | ^^^^^^^^^ ------- +help: consider using `as_ref` instead + | +LL | opt.as_ref().and_then(|arg| Some(takes_ref(arg))); + | +++++++++ error[E0308]: mismatched types --> $DIR/as-ref.rs:10:29 | LL | opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found `Foo` - | | | - | | arguments to this function are incorrect - | help: consider using `as_ref` instead: `as_ref().map` + | --------- ^^^ expected `&Foo`, found `Foo` + | | + | arguments to this function are incorrect | note: function defined here --> $DIR/as-ref.rs:3:4 | LL | fn takes_ref(_: &Foo) {} | ^^^^^^^^^ ------- +help: consider using `as_ref` instead + | +LL | opt.as_ref().map(|arg| takes_ref(arg)); + | +++++++++ error[E0308]: mismatched types --> $DIR/as-ref.rs:11:37 | LL | opt.and_then(|arg| Ok(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found `Foo` - | | | - | | arguments to this function are incorrect - | help: consider using `as_ref` instead: `as_ref().and_then` + | --------- ^^^ expected `&Foo`, found `Foo` + | | + | arguments to this function are incorrect | note: function defined here --> $DIR/as-ref.rs:3:4 | LL | fn takes_ref(_: &Foo) {} | ^^^^^^^^^ ------- +help: consider using `as_ref` instead + | +LL | opt.as_ref().and_then(|arg| Ok(takes_ref(arg))); + | +++++++++ error[E0308]: mismatched types --> $DIR/as-ref.rs:13:29 @@ -101,61 +113,73 @@ error[E0308]: mismatched types --> $DIR/as-ref.rs:22:42 | LL | multiple_ref_opt.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found `Foo` - | | | - | | arguments to this function are incorrect - | help: consider using `as_ref` instead: `as_ref().map` + | --------- ^^^ expected `&Foo`, found `Foo` + | | + | arguments to this function are incorrect | note: function defined here --> $DIR/as-ref.rs:3:4 | LL | fn takes_ref(_: &Foo) {} | ^^^^^^^^^ ------- +help: consider using `as_ref` instead + | +LL | multiple_ref_opt.as_ref().map(|arg| takes_ref(arg)); + | +++++++++ error[E0308]: mismatched types --> $DIR/as-ref.rs:23:52 | LL | multiple_ref_opt.and_then(|arg| Some(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found `Foo` - | | | - | | arguments to this function are incorrect - | help: consider using `as_ref` instead: `as_ref().and_then` + | --------- ^^^ expected `&Foo`, found `Foo` + | | + | arguments to this function are incorrect | note: function defined here --> $DIR/as-ref.rs:3:4 | LL | fn takes_ref(_: &Foo) {} | ^^^^^^^^^ ------- +help: consider using `as_ref` instead + | +LL | multiple_ref_opt.as_ref().and_then(|arg| Some(takes_ref(arg))); + | +++++++++ error[E0308]: mismatched types --> $DIR/as-ref.rs:25:45 | LL | multiple_ref_result.map(|arg| takes_ref(arg)); - | --- --------- ^^^ expected `&Foo`, found `Foo` - | | | - | | arguments to this function are incorrect - | help: consider using `as_ref` instead: `as_ref().map` + | --------- ^^^ expected `&Foo`, found `Foo` + | | + | arguments to this function are incorrect | note: function defined here --> $DIR/as-ref.rs:3:4 | LL | fn takes_ref(_: &Foo) {} | ^^^^^^^^^ ------- +help: consider using `as_ref` instead + | +LL | multiple_ref_result.as_ref().map(|arg| takes_ref(arg)); + | +++++++++ error[E0308]: mismatched types --> $DIR/as-ref.rs:26:53 | LL | multiple_ref_result.and_then(|arg| Ok(takes_ref(arg))); - | -------- --------- ^^^ expected `&Foo`, found `Foo` - | | | - | | arguments to this function are incorrect - | help: consider using `as_ref` instead: `as_ref().and_then` + | --------- ^^^ expected `&Foo`, found `Foo` + | | + | arguments to this function are incorrect | note: function defined here --> $DIR/as-ref.rs:3:4 | LL | fn takes_ref(_: &Foo) {} | ^^^^^^^^^ ------- +help: consider using `as_ref` instead + | +LL | multiple_ref_result.as_ref().and_then(|arg| Ok(takes_ref(arg))); + | +++++++++ error: aborting due to 11 previous errors From 5e94b5faf1f0812207a9128e2754bd146210b16e Mon Sep 17 00:00:00 2001 From: yukang Date: Mon, 8 May 2023 14:52:52 +0800 Subject: [PATCH 74/97] code refactor and fix wrong suggestion --- .../rustc_parse/src/parser/diagnostics.rs | 52 +++++++++++-------- compiler/rustc_parse/src/parser/stmt.rs | 8 ++- tests/ui/type/missing-let-in-binding-4.rs | 5 ++ tests/ui/type/missing-let-in-binding-4.stderr | 10 ++++ 4 files changed, 51 insertions(+), 24 deletions(-) create mode 100644 tests/ui/type/missing-let-in-binding-4.rs create mode 100644 tests/ui/type/missing-let-in-binding-4.stderr diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index 456c6243bbbb..b0822fe79565 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -399,29 +399,6 @@ impl<'a> Parser<'a> { } } } - // we suggest add the missing `let` before the identifier - // `a: Ty = 1` -> `let a: Ty = 1` - if self.token == token::Colon { - let prev_span = self.prev_token.span.shrink_to_lo(); - let snapshot = self.create_snapshot_for_diagnostic(); - self.bump(); - match self.parse_ty() { - Ok(_) => { - if self.token == token::Eq { - err.span_suggestion_verbose( - prev_span, - "you might have meant to introduce a new binding", - "let ".to_string(), - Applicability::MaybeIncorrect, - ); - } - } - Err(err) => { - err.cancel(); - } - } - self.restore_snapshot(snapshot); - } if let Some(recovered_ident) = recovered_ident && recover { err.emit(); @@ -1029,6 +1006,35 @@ impl<'a> Parser<'a> { Err(e) } + /// Suggest add the missing `let` before the identifier in stmt + /// `a: Ty = 1` -> `let a: Ty = 1` + pub(super) fn suggest_add_missing_let_for_stmt( + &mut self, + err: &mut DiagnosticBuilder<'a, ErrorGuaranteed>, + ) { + if self.token == token::Colon { + let prev_span = self.prev_token.span.shrink_to_lo(); + let snapshot = self.create_snapshot_for_diagnostic(); + self.bump(); + match self.parse_ty() { + Ok(_) => { + if self.token == token::Eq { + err.span_suggestion_verbose( + prev_span, + "you might have meant to introduce a new binding", + "let ".to_string(), + Applicability::MaybeIncorrect, + ); + } + } + Err(e) => { + e.cancel(); + } + } + self.restore_snapshot(snapshot); + } + } + /// Check to see if a pair of chained operators looks like an attempt at chained comparison, /// e.g. `1 < x <= 3`. If so, suggest either splitting the comparison into two, or /// parenthesising the leftmost comparison. diff --git a/compiler/rustc_parse/src/parser/stmt.rs b/compiler/rustc_parse/src/parser/stmt.rs index ab04219b1772..c35c32f272a9 100644 --- a/compiler/rustc_parse/src/parser/stmt.rs +++ b/compiler/rustc_parse/src/parser/stmt.rs @@ -99,7 +99,13 @@ impl<'a> Parser<'a> { ForceCollect::Yes => { self.collect_tokens_no_attrs(|this| this.parse_stmt_path_start(lo, attrs))? } - ForceCollect::No => self.parse_stmt_path_start(lo, attrs)?, + ForceCollect::No => match self.parse_stmt_path_start(lo, attrs) { + Ok(stmt) => stmt, + Err(mut err) => { + self.suggest_add_missing_let_for_stmt(&mut err); + return Err(err); + } + }, } } else if let Some(item) = self.parse_item_common( attrs.clone(), diff --git a/tests/ui/type/missing-let-in-binding-4.rs b/tests/ui/type/missing-let-in-binding-4.rs new file mode 100644 index 000000000000..879a6fedcd67 --- /dev/null +++ b/tests/ui/type/missing-let-in-binding-4.rs @@ -0,0 +1,5 @@ +struct A { + : u8 =, //~ ERROR expected identifier, found `:` +} + +fn main() {} diff --git a/tests/ui/type/missing-let-in-binding-4.stderr b/tests/ui/type/missing-let-in-binding-4.stderr new file mode 100644 index 000000000000..e6f173a66587 --- /dev/null +++ b/tests/ui/type/missing-let-in-binding-4.stderr @@ -0,0 +1,10 @@ +error: expected identifier, found `:` + --> $DIR/missing-let-in-binding-4.rs:2:5 + | +LL | struct A { + | - while parsing this struct +LL | : u8 =, + | ^ expected identifier + +error: aborting due to previous error + From 6b76588222eb1a69f681c00f9d073edb43401ba7 Mon Sep 17 00:00:00 2001 From: yukang Date: Wed, 3 May 2023 10:40:08 +0800 Subject: [PATCH 75/97] suggest struct when we get colon in fileds in enum --- compiler/rustc_parse/src/parser/item.rs | 9 +++++++++ tests/ui/structs-enums/issue-103869.fixed | 13 +++++++++++++ tests/ui/{parser => structs-enums}/issue-103869.rs | 11 ++++++++--- .../{parser => structs-enums}/issue-103869.stderr | 9 +++++++-- 4 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 tests/ui/structs-enums/issue-103869.fixed rename tests/ui/{parser => structs-enums}/issue-103869.rs (56%) rename tests/ui/{parser => structs-enums}/issue-103869.stderr (71%) diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 6ca88200dc51..2a47711a8d3e 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1262,6 +1262,7 @@ impl<'a> Parser<'a> { } } + let prev_span = self.prev_token.span; let id = self.parse_ident()?; let mut generics = self.parse_generics()?; generics.where_clause = self.parse_where_clause()?; @@ -1275,6 +1276,14 @@ impl<'a> Parser<'a> { self.parse_delim_comma_seq(Delimiter::Brace, |p| p.parse_enum_variant()).map_err( |mut e| { e.span_label(id.span, "while parsing this enum"); + if self.token == token::Colon { + e.span_suggestion_verbose( + prev_span, + "perhaps you meant to use `struct` here", + "struct".to_string(), + Applicability::MaybeIncorrect, + ); + } self.recover_stmt(); e }, diff --git a/tests/ui/structs-enums/issue-103869.fixed b/tests/ui/structs-enums/issue-103869.fixed new file mode 100644 index 000000000000..49fe32c71091 --- /dev/null +++ b/tests/ui/structs-enums/issue-103869.fixed @@ -0,0 +1,13 @@ +// run-rustfix + +struct VecOrMap { + //~^ HELP: perhaps you meant to use `struct` here + vec: Vec, + //~^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found `:` + //~| HELP: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` +} + +fn main() { + let o = VecOrMap { vec: vec![1, 2, 3] }; + println!("{:?}", o.vec); +} diff --git a/tests/ui/parser/issue-103869.rs b/tests/ui/structs-enums/issue-103869.rs similarity index 56% rename from tests/ui/parser/issue-103869.rs rename to tests/ui/structs-enums/issue-103869.rs index 9213437458a5..729079e05011 100644 --- a/tests/ui/parser/issue-103869.rs +++ b/tests/ui/structs-enums/issue-103869.rs @@ -1,8 +1,13 @@ -enum VecOrMap{ +// run-rustfix + +enum VecOrMap { + //~^ HELP: perhaps you meant to use `struct` here vec: Vec, //~^ ERROR expected one of `(`, `,`, `=`, `{`, or `}`, found `:` //~| HELP: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` - map: HashMap } -fn main() {} +fn main() { + let o = VecOrMap { vec: vec![1, 2, 3] }; + println!("{:?}", o.vec); +} diff --git a/tests/ui/parser/issue-103869.stderr b/tests/ui/structs-enums/issue-103869.stderr similarity index 71% rename from tests/ui/parser/issue-103869.stderr rename to tests/ui/structs-enums/issue-103869.stderr index 9eb20e2005a4..4665ebf89a3c 100644 --- a/tests/ui/parser/issue-103869.stderr +++ b/tests/ui/structs-enums/issue-103869.stderr @@ -1,12 +1,17 @@ error: expected one of `(`, `,`, `=`, `{`, or `}`, found `:` - --> $DIR/issue-103869.rs:2:8 + --> $DIR/issue-103869.rs:5:8 | -LL | enum VecOrMap{ +LL | enum VecOrMap { | -------- while parsing this enum +LL | LL | vec: Vec, | ^ expected one of `(`, `,`, `=`, `{`, or `}` | = help: enum variants can be `Variant`, `Variant = `, `Variant(Type, ..., TypeN)` or `Variant { fields: Types }` +help: perhaps you meant to use `struct` here + | +LL | struct VecOrMap { + | ~~~~~~ error: aborting due to previous error From 0e8703da3e33a76d12186e36a23c87870bc5d7bb Mon Sep 17 00:00:00 2001 From: yukang Date: Sat, 6 May 2023 02:27:32 +0800 Subject: [PATCH 76/97] make it more accurate by parsing ty --- compiler/rustc_parse/src/parser/item.rs | 28 +++++++++++++++++-------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_parse/src/parser/item.rs b/compiler/rustc_parse/src/parser/item.rs index 2a47711a8d3e..49e05efd39d5 100644 --- a/compiler/rustc_parse/src/parser/item.rs +++ b/compiler/rustc_parse/src/parser/item.rs @@ -1274,18 +1274,28 @@ impl<'a> Parser<'a> { (thin_vec![], false) } else { self.parse_delim_comma_seq(Delimiter::Brace, |p| p.parse_enum_variant()).map_err( - |mut e| { - e.span_label(id.span, "while parsing this enum"); + |mut err| { + err.span_label(id.span, "while parsing this enum"); if self.token == token::Colon { - e.span_suggestion_verbose( - prev_span, - "perhaps you meant to use `struct` here", - "struct".to_string(), - Applicability::MaybeIncorrect, - ); + let snapshot = self.create_snapshot_for_diagnostic(); + self.bump(); + match self.parse_ty() { + Ok(_) => { + err.span_suggestion_verbose( + prev_span, + "perhaps you meant to use `struct` here", + "struct".to_string(), + Applicability::MaybeIncorrect, + ); + } + Err(e) => { + e.cancel(); + } + } + self.restore_snapshot(snapshot); } self.recover_stmt(); - e + err }, )? }; From f7e54b85c42122b6e0a87eadecbac7b4ae8d5d04 Mon Sep 17 00:00:00 2001 From: Kisaragi Marine Date: Mon, 8 May 2023 19:03:16 +0900 Subject: [PATCH 77/97] stdarch: update submodule, take 5 --- library/stdarch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/stdarch b/library/stdarch index 461aad2bb662..7e2cdc675b92 160000 --- a/library/stdarch +++ b/library/stdarch @@ -1 +1 @@ -Subproject commit 461aad2bb66270c3b49bbcb1a753fa1d0dffac26 +Subproject commit 7e2cdc675b92165c5f8c4c794620252be4605e74 From a4014f08a77f5e1df79e04492440eb1dbdc478bc Mon Sep 17 00:00:00 2001 From: Kisaragi Marine Date: Mon, 8 May 2023 19:09:12 +0900 Subject: [PATCH 78/97] std: remove test for arm's crypto feature please see https://github.com/rust-lang/rust/pull/110285#issuecomment-1521201953 for more details --- library/std/tests/run-time-detect.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/library/std/tests/run-time-detect.rs b/library/std/tests/run-time-detect.rs index bf3c81fcc980..9ce29a33df6e 100644 --- a/library/std/tests/run-time-detect.rs +++ b/library/std/tests/run-time-detect.rs @@ -16,7 +16,6 @@ fn arm_linux() { // tidy-alphabetical-start println!("aes: {}", is_arm_feature_detected!("aes")); println!("crc: {}", is_arm_feature_detected!("crc")); - println!("crypto: {}", is_arm_feature_detected!("crypto")); println!("neon: {}", is_arm_feature_detected!("neon")); println!("pmull: {}", is_arm_feature_detected!("pmull")); println!("sha2: {}", is_arm_feature_detected!("sha2")); From 8e2da80fc53e8717260a2927ba039dcb15b92937 Mon Sep 17 00:00:00 2001 From: Jakob Degen Date: Sat, 29 Apr 2023 19:02:45 -0700 Subject: [PATCH 79/97] Disable nrvo mir opt --- compiler/rustc_mir_transform/src/nrvo.rs | 3 +- tests/codegen/fewer-names.rs | 14 +- tests/codegen/mem-replace-big-type.rs | 18 +-- tests/codegen/nrvo.rs | 2 +- tests/codegen/var-names.rs | 4 +- .../inline_into_box_place.main.Inline.diff | 12 +- ...67_inline_as_ref_as_mut.b.Inline.after.mir | 14 +- ...67_inline_as_ref_as_mut.d.Inline.after.mir | 14 +- ...unchecked_shl_unsigned_smaller.Inline.diff | 129 ++---------------- ..._shl_unsigned_smaller.PreCodegen.after.mir | 120 ++-------------- ...s.unchecked_shr_signed_smaller.Inline.diff | 129 ++---------------- ...ed_shr_signed_smaller.PreCodegen.after.mir | 120 ++-------------- ...rap_unchecked.unwrap_unchecked.Inline.diff | 8 +- ...cked.unwrap_unchecked.PreCodegen.after.mir | 8 +- tests/mir-opt/nrvo_miscompile_111005.rs | 22 +++ ...ompile_111005.wrong.RenameReturnPlace.diff | 18 +++ ...eplace.manual_replace.PreCodegen.after.mir | 10 +- ...m_replace.mem_replace.PreCodegen.after.mir | 42 +++--- ...t_unchecked_mut_range.PreCodegen.after.mir | 124 ++++++++--------- ...dex.slice_index_range.PreCodegen.after.mir | 10 +- 20 files changed, 247 insertions(+), 574 deletions(-) create mode 100644 tests/mir-opt/nrvo_miscompile_111005.rs create mode 100644 tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff diff --git a/compiler/rustc_mir_transform/src/nrvo.rs b/compiler/rustc_mir_transform/src/nrvo.rs index b6e73eaad509..85b26220b1e8 100644 --- a/compiler/rustc_mir_transform/src/nrvo.rs +++ b/compiler/rustc_mir_transform/src/nrvo.rs @@ -34,7 +34,8 @@ pub struct RenameReturnPlace; impl<'tcx> MirPass<'tcx> for RenameReturnPlace { fn is_enabled(&self, sess: &rustc_session::Session) -> bool { - sess.mir_opt_level() > 0 + // #111005 + sess.mir_opt_level() > 0 && sess.opts.unstable_opts.unsound_mir_opts } fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut mir::Body<'tcx>) { diff --git a/tests/codegen/fewer-names.rs b/tests/codegen/fewer-names.rs index 7f383a5c1497..df1080bff2b1 100644 --- a/tests/codegen/fewer-names.rs +++ b/tests/codegen/fewer-names.rs @@ -7,14 +7,14 @@ #[no_mangle] pub fn sum(x: u32, y: u32) -> u32 { -// YES-LABEL: define{{.*}}i32 @sum(i32 noundef %0, i32 noundef %1) -// YES-NEXT: %3 = add i32 %1, %0 -// YES-NEXT: ret i32 %3 + // YES-LABEL: define{{.*}}i32 @sum(i32 noundef %0, i32 noundef %1) + // YES-NEXT: %3 = add i32 %1, %0 + // YES-NEXT: ret i32 %3 -// NO-LABEL: define{{.*}}i32 @sum(i32 noundef %x, i32 noundef %y) -// NO-NEXT: start: -// NO-NEXT: %0 = add i32 %y, %x -// NO-NEXT: ret i32 %0 + // NO-LABEL: define{{.*}}i32 @sum(i32 noundef %x, i32 noundef %y) + // NO-NEXT: start: + // NO-NEXT: %z = add i32 %y, %x + // NO-NEXT: ret i32 %z let z = x + y; z } diff --git a/tests/codegen/mem-replace-big-type.rs b/tests/codegen/mem-replace-big-type.rs index 81e56b5490d6..acf759ebe545 100644 --- a/tests/codegen/mem-replace-big-type.rs +++ b/tests/codegen/mem-replace-big-type.rs @@ -13,7 +13,8 @@ pub struct Big([u64; 7]); pub fn replace_big(dst: &mut Big, src: Big) -> Big { // Back in 1.68, this emitted six `memcpy`s. // `read_via_copy` in 1.69 got that down to three. - // `write_via_move` has it down to just the two essential ones. + // `write_via_move` it was originally down to the essential two, however + // with nrvo disabled it is back at 3 std::mem::replace(dst, src) } @@ -22,13 +23,14 @@ pub fn replace_big(dst: &mut Big, src: Big) -> Big { // CHECK-NOT: call void @llvm.memcpy -// For a large type, we expect exactly two `memcpy`s +// For a large type, we expect exactly three `memcpy`s // CHECK-LABEL: define internal void @{{.+}}mem{{.+}}replace{{.+}}sret(%Big) - // CHECK-NOT: alloca - // CHECK-NOT: call void @llvm.memcpy - // CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %0, {{i8\*|ptr}} align 8 %dest, i{{.*}} 56, i1 false) - // CHECK-NOT: call void @llvm.memcpy - // CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %dest, {{i8\*|ptr}} align 8 %src, i{{.*}} 56, i1 false) - // CHECK-NOT: call void @llvm.memcpy +// CHECK-NOT: call void @llvm.memcpy +// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %result, {{i8\*|ptr}} align 8 %dest, i{{.*}} 56, i1 false) +// CHECK-NOT: call void @llvm.memcpy +// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %dest, {{i8\*|ptr}} align 8 %src, i{{.*}} 56, i1 false) +// CHECK-NOT: call void @llvm.memcpy +// CHECK: call void @llvm.memcpy.{{.+}}({{i8\*|ptr}} align 8 %0, {{i8\*|ptr}} align 8 %result, i{{.*}} 56, i1 false) +// CHECK-NOT: call void @llvm.memcpy // CHECK-NOT: call void @llvm.memcpy diff --git a/tests/codegen/nrvo.rs b/tests/codegen/nrvo.rs index fddb0d1fb3c8..b2ae99f3761b 100644 --- a/tests/codegen/nrvo.rs +++ b/tests/codegen/nrvo.rs @@ -8,7 +8,7 @@ pub fn nrvo(init: fn(&mut [u8; 4096])) -> [u8; 4096] { // CHECK-LABEL: nrvo // CHECK: @llvm.memset - // CHECK-NOT: @llvm.memcpy + // FIXME: turn on nrvo then check-not: @llvm.memcpy // CHECK: ret // CHECK-EMPTY let mut buf = [0; 4096]; diff --git a/tests/codegen/var-names.rs b/tests/codegen/var-names.rs index 53841df32e8d..d4715efad73c 100644 --- a/tests/codegen/var-names.rs +++ b/tests/codegen/var-names.rs @@ -9,7 +9,7 @@ pub fn test(a: u32, b: u32) -> u32 { // CHECK: %c = add i32 %a, %b let d = c; let e = d * a; - // CHECK-NEXT: %0 = mul i32 %c, %a + // CHECK-NEXT: %e = mul i32 %c, %a e - // CHECK-NEXT: ret i32 %0 + // CHECK-NEXT: ret i32 %e } diff --git a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff b/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff index a5129e0e8c8e..94f24b50ab79 100644 --- a/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff +++ b/tests/mir-opt/inline/inline_into_box_place.main.Inline.diff @@ -16,7 +16,8 @@ + let mut _4: usize; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _5: usize; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _6: *mut u8; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL -+ let mut _7: *const std::vec::Vec; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _7: std::boxed::Box>; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ let mut _8: *const std::vec::Vec; // in scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + scope 4 { + } + } @@ -65,9 +66,12 @@ bb3: { - StorageDead(_1); // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 - return; // scope 0 at $DIR/inline_into_box_place.rs:+2:2: +2:2 -+ _1 = ShallowInitBox(move _6, std::vec::Vec); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL -+ _7 = (((_1.0: std::ptr::Unique>).0: std::ptr::NonNull>).0: *const std::vec::Vec); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL -+ (*_7) = move _2; // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ StorageLive(_7); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _7 = ShallowInitBox(move _6, std::vec::Vec); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _8 = (((_7.0: std::ptr::Unique>).0: std::ptr::NonNull>).0: *const std::vec::Vec); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ (*_8) = move _2; // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ _1 = move _7; // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL ++ StorageDead(_7); // scope 3 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageDead(_2); // scope 0 at $DIR/inline_into_box_place.rs:+1:48: +1:49 + _0 = const (); // scope 0 at $DIR/inline_into_box_place.rs:+0:11: +2:2 + drop(_1) -> [return: bb1, unwind: bb2]; // scope 0 at $DIR/inline_into_box_place.rs:+2:1: +2:2 diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir index 21570a88a6be..8c4ab2557a54 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.b.Inline.after.mir @@ -8,8 +8,9 @@ fn b(_1: &mut Box) -> &mut T { let mut _4: &mut std::boxed::Box; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 scope 1 (inlined as AsMut>::as_mut) { // at $DIR/issue_58867_inline_as_ref_as_mut.rs:8:7: 8:15 debug self => _4; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - let mut _5: std::boxed::Box; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - let mut _6: *const T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _5: &mut T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _6: std::boxed::Box; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _7: *const T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL } bb0: { @@ -17,9 +18,12 @@ fn b(_1: &mut Box) -> &mut T { StorageLive(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 StorageLive(_4); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 _4 = &mut (*_1); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 - _5 = deref_copy (*_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - _6 = (((_5.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - _3 = &mut (*_6); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageLive(_5); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:7: +1:15 + _6 = deref_copy (*_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _7 = (((_6.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _5 = &mut (*_7); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _3 = _5; // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageDead(_5); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:7: +1:15 _2 = &mut (*_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 StorageDead(_4); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:14: +1:15 _0 = &mut (*_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 diff --git a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir index 4f9342247d70..b18a41b622e6 100644 --- a/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir +++ b/tests/mir-opt/inline/issue_58867_inline_as_ref_as_mut.d.Inline.after.mir @@ -7,17 +7,21 @@ fn d(_1: &Box) -> &T { let mut _3: &std::boxed::Box; // in scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 scope 1 (inlined as AsRef>::as_ref) { // at $DIR/issue_58867_inline_as_ref_as_mut.rs:18:7: 18:15 debug self => _3; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - let mut _4: std::boxed::Box; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - let mut _5: *const T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let _4: &T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _5: std::boxed::Box; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + let mut _6: *const T; // in scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL } bb0: { StorageLive(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 StorageLive(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 _3 = &(*_1); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 - _4 = deref_copy (*_3); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - _5 = (((_4.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL - _2 = &(*_5); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageLive(_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _5 = deref_copy (*_3); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _6 = (((_5.0: std::ptr::Unique).0: std::ptr::NonNull).0: *const T); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _4 = &(*_6); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + _2 = _4; // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL + StorageDead(_4); // scope 1 at $SRC_DIR/alloc/src/boxed.rs:LL:COL _0 = &(*_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:5: +1:15 StorageDead(_3); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+1:14: +1:15 StorageDead(_2); // scope 0 at $DIR/issue_58867_inline_as_ref_as_mut.rs:+2:1: +2:2 diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff index d76cd0e2bb81..473e02f1cb1c 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.diff @@ -12,51 +12,7 @@ + debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + let mut _5: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _6: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ let mut _7: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 2 { -+ scope 3 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ debug x => _7; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ let mut _8: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ let mut _9: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ scope 4 { -+ scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ debug self => _7; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ scope 6 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ debug u => _7; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _10: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _11: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _12: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ } -+ } -+ scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ debug self => _9; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ let mut _13: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ let _14: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ scope 8 { -+ debug x => _14; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ } -+ scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ debug self => _8; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ let mut _15: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ let mut _16: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ scope 10 { -+ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ scope 11 { -+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL -+ scope 14 { -+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL -+ } -+ } -+ } -+ } -+ scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL -+ debug self => _15; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ } -+ } -+ } + } + } @@ -66,87 +22,30 @@ StorageLive(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 _4 = _2; // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 - _0 = core::num::::unchecked_shl(move _3, move _4) -> bb1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:23 -- // mir::Constant -- // + span: $DIR/unchecked_shifts.rs:11:7: 11:20 -- // + literal: Const { ty: unsafe fn(u16, u32) -> u16 {core::num::::unchecked_shl}, val: Value() } + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _6 = (_4,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ _7 = move (_6.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _11 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _10 = Gt(_7, move _11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ switchInt(move _10) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _5 = core::num::::unchecked_shl::conv(move (_6.0: u32)) -> bb1; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + // mir::Constant +- // + span: $DIR/unchecked_shifts.rs:11:7: 11:20 +- // + literal: Const { ty: unsafe fn(u16, u32) -> u16 {core::num::::unchecked_shl}, val: Value() } ++ // + span: $SRC_DIR/core/src/num/mod.rs:LL:COL ++ // + literal: Const { ty: fn(u32) -> u16 {core::num::::unchecked_shl::conv}, val: Value() } } bb1: { ++ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _0 = unchecked_shl::(_3, move _5) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL ++ // mir::Constant ++ // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL ++ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::}, val: Value() } ++ } ++ ++ bb2: { + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 -+ } -+ -+ bb2: { -+ _9 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ // mir::Constant -+ // + span: no-location -+ // + literal: Const { ty: TryFromIntError, val: Value() } -+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ } -+ -+ bb3: { -+ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _12 = _7 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _9 = Result::::Ok(move _12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ } -+ -+ bb4: { -+ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ _13 = discriminant(_9); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ switchInt(move _13) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ -+ bb5: { -+ _8 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ -+ bb6: { -+ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ -+ bb7: { -+ _14 = move ((_9 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ _8 = Option::::Some(move _14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL -+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ -+ bb8: { -+ StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ _16 = discriminant(_8); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ switchInt(move _16) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ -+ bb9: { -+ _5 = move ((_8 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ StorageDead(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ _0 = unchecked_shl::(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ // mir::Constant -+ // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL -+ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::}, val: Value() } } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir index 3c175ed1504f..9b7b11ef659a 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.mir @@ -9,51 +9,7 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL let mut _3: u16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 2 { - scope 3 (inlined core::num::::unchecked_shl::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _6: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _7: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - scope 4 { - scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - scope 6 (inlined convert::num:: for u16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _10: u16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - } - } - scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - let _12: u16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - scope 8 { - debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - } - } - scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - scope 10 { - debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL - } - scope 11 { - scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL - scope 14 { - scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - } - scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL - debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL - } - } - } - } } } @@ -61,78 +17,22 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 { StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _9 = const 65535_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _3 = core::num::::unchecked_shl::conv(move (_4.0: u32)) -> bb1; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/mod.rs:LL:COL + // + literal: Const { ty: fn(u32) -> u16 {core::num::::unchecked_shl::conv}, val: Value() } } bb1: { - StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL - return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 - } - - bb2: { - _7 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: TryFromIntError, val: Value() } - goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - } - - bb3: { - StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _10 = _5 as u16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _7 = Result::::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - } - - bb4: { - StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb5: { - _6 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb6: { - unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb7: { - _12 = move ((_7 as Ok).0: u16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - _6 = Option::::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb8: { - StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - } - - bb9: { - _3 = move ((_6 as Some).0: u16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _0 = unchecked_shl::(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + _0 = unchecked_shl::(_1, move _3) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(u16, u16) -> u16 {unchecked_shl::}, val: Value() } } + + bb2: { + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL + return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff index f3d3e6090bb3..9638ddda46b7 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.Inline.diff @@ -12,51 +12,7 @@ + debug rhs => _4; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + let mut _5: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + let mut _6: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ let mut _7: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL + scope 2 { -+ scope 3 (inlined core::num::::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ debug x => _7; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ let mut _8: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ let mut _9: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ scope 4 { -+ scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ debug self => _7; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ scope 6 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL -+ debug u => _7; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _10: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _11: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ let mut _12: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ } -+ } -+ scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ debug self => _9; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ let mut _13: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ let _14: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ scope 8 { -+ debug x => _14; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ } -+ scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ debug self => _8; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ let mut _15: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ let mut _16: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ scope 10 { -+ debug val => _5; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ scope 11 { -+ scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL -+ scope 14 { -+ scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL -+ } -+ } -+ } -+ } -+ scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL -+ debug self => _15; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ } -+ } -+ } + } + } @@ -66,87 +22,30 @@ StorageLive(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 _4 = _2; // scope 0 at $DIR/unchecked_shifts.rs:+1:21: +1:22 - _0 = core::num::::unchecked_shr(move _3, move _4) -> bb1; // scope 0 at $DIR/unchecked_shifts.rs:+1:5: +1:23 -- // mir::Constant -- // + span: $DIR/unchecked_shifts.rs:17:7: 17:20 -- // + literal: Const { ty: unsafe fn(i16, u32) -> i16 {core::num::::unchecked_shr}, val: Value() } + StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + StorageLive(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + _6 = (_4,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ _7 = move (_6.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageLive(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _11 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _10 = Gt(_7, move _11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageDead(_11); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ switchInt(move _10) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL ++ _5 = core::num::::unchecked_shr::conv(move (_6.0: u32)) -> bb1; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + // mir::Constant +- // + span: $DIR/unchecked_shifts.rs:17:7: 17:20 +- // + literal: Const { ty: unsafe fn(i16, u32) -> i16 {core::num::::unchecked_shr}, val: Value() } ++ // + span: $SRC_DIR/core/src/num/mod.rs:LL:COL ++ // + literal: Const { ty: fn(u32) -> i16 {core::num::::unchecked_shr::conv}, val: Value() } } bb1: { ++ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL ++ _0 = unchecked_shr::(_3, move _5) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL ++ // mir::Constant ++ // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL ++ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::}, val: Value() } ++ } ++ ++ bb2: { + StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL StorageDead(_4); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 StorageDead(_3); // scope 0 at $DIR/unchecked_shifts.rs:+1:22: +1:23 return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 -+ } -+ -+ bb2: { -+ _9 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ // mir::Constant -+ // + span: no-location -+ // + literal: Const { ty: TryFromIntError, val: Value() } -+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ } -+ -+ bb3: { -+ StorageLive(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _12 = _7 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ _9 = Result::::Ok(move _12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageDead(_12); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ } -+ -+ bb4: { -+ StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL -+ StorageLive(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ _13 = discriminant(_9); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ switchInt(move _13) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ -+ bb5: { -+ _8 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ -+ bb6: { -+ unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ -+ bb7: { -+ _14 = move ((_9 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ _8 = Option::::Some(move _14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL -+ goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL -+ } -+ -+ bb8: { -+ StorageDead(_14); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageDead(_9); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageLive(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ _16 = discriminant(_8); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ switchInt(move _16) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ } -+ -+ bb9: { -+ _5 = move ((_8 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL -+ StorageDead(_15); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageDead(_8); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageDead(_7); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ StorageDead(_6); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL -+ _0 = unchecked_shr::(_3, move _5) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ // mir::Constant -+ // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL -+ // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::}, val: Value() } } } diff --git a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir index 724b3c56723a..afe6d08741b4 100644 --- a/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir +++ b/tests/mir-opt/inline/unchecked_shifts.unchecked_shr_signed_smaller.PreCodegen.after.mir @@ -9,51 +9,7 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { debug rhs => _2; // in scope 1 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL let mut _3: i16; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL let mut _4: (u32,); // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _5: u32; // in scope 1 at $SRC_DIR/core/src/num/mod.rs:LL:COL scope 2 { - scope 3 (inlined core::num::::unchecked_shr::conv) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug x => _5; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _6: std::option::Option; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - let mut _7: std::result::Result; // in scope 3 at $SRC_DIR/core/src/num/mod.rs:LL:COL - scope 4 { - scope 5 (inlined >::try_into) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _5; // in scope 5 at $SRC_DIR/core/src/convert/mod.rs:LL:COL - scope 6 (inlined convert::num:: for i16>::try_from) { // at $SRC_DIR/core/src/convert/mod.rs:LL:COL - debug u => _5; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _8: bool; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _9: u32; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - let mut _10: i16; // in scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - } - } - scope 7 (inlined Result::::ok) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _7; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - let mut _11: isize; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - let _12: i16; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - scope 8 { - debug x => _12; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - } - } - scope 9 (inlined #[track_caller] Option::::unwrap_unchecked) { // at $SRC_DIR/core/src/num/mod.rs:LL:COL - debug self => _6; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _13: &std::option::Option; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - let mut _14: isize; // in scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - scope 10 { - debug val => _3; // in scope 10 at $SRC_DIR/core/src/option.rs:LL:COL - } - scope 11 { - scope 13 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL - scope 14 { - scope 15 (inlined unreachable_unchecked::runtime) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - } - } - } - } - scope 12 (inlined Option::::is_some) { // at $SRC_DIR/core/src/option.rs:LL:COL - debug self => _13; // in scope 12 at $SRC_DIR/core/src/option.rs:LL:COL - } - } - } - } } } @@ -61,78 +17,22 @@ fn unchecked_shr_signed_smaller(_1: i16, _2: u32) -> i16 { StorageLive(_3); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageLive(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL _4 = (_2,); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _5 = move (_4.0: u32); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _9 = const 32767_u32; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _8 = Gt(_5, move _9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_9); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - switchInt(move _8) -> [0: bb3, otherwise: bb2]; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL + _3 = core::num::::unchecked_shr::conv(move (_4.0: u32)) -> bb1; // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL + // mir::Constant + // + span: $SRC_DIR/core/src/num/mod.rs:LL:COL + // + literal: Const { ty: fn(u32) -> i16 {core::num::::unchecked_shr::conv}, val: Value() } } bb1: { - StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL - return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 - } - - bb2: { - _7 = Result::::Err(const TryFromIntError(())); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - // mir::Constant - // + span: no-location - // + literal: Const { ty: TryFromIntError, val: Value() } - goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - } - - bb3: { - StorageLive(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _10 = _5 as i16 (IntToInt); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - _7 = Result::::Ok(move _10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageDead(_10); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - goto -> bb4; // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - } - - bb4: { - StorageDead(_8); // scope 6 at $SRC_DIR/core/src/convert/num.rs:LL:COL - StorageLive(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _11 = discriminant(_7); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - switchInt(move _11) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb5: { - _6 = Option::::None; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb6: { - unreachable; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb7: { - _12 = move ((_7 as Ok).0: i16); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - _6 = Option::::Some(move _12); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL - goto -> bb8; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL - } - - bb8: { - StorageDead(_12); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_7); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageLive(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _14 = discriminant(_6); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - switchInt(move _14) -> [1: bb9, otherwise: bb6]; // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - } - - bb9: { - _3 = move ((_6 as Some).0: i16); // scope 9 at $SRC_DIR/core/src/option.rs:LL:COL - StorageDead(_13); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_6); // scope 4 at $SRC_DIR/core/src/num/mod.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL StorageDead(_4); // scope 2 at $SRC_DIR/core/src/num/mod.rs:LL:COL - _0 = unchecked_shr::(_1, move _3) -> [return: bb1, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + _0 = unchecked_shr::(_1, move _3) -> [return: bb2, unwind unreachable]; // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/num/int_macros.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(i16, i16) -> i16 {unchecked_shr::}, val: Value() } } + + bb2: { + StorageDead(_3); // scope 2 at $SRC_DIR/core/src/num/int_macros.rs:LL:COL + return; // scope 0 at $DIR/unchecked_shifts.rs:+2:2: +2:2 + } } diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff index 8a8cd896e85d..778ecc46d730 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.Inline.diff @@ -9,8 +9,9 @@ + debug self => _2; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _3: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let mut _4: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ let _5: T; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + scope 2 { -+ debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL ++ debug val => _5; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + } + scope 3 { + scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL @@ -46,7 +47,10 @@ - bb2 (cleanup): { - resume; // scope 0 at $DIR/unwrap_unchecked.rs:+0:1: +2:2 + bb2: { -+ _0 = move ((_2 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ StorageLive(_5); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ _5 = move ((_2 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL ++ _0 = move _5; // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL ++ StorageDead(_5); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_3); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 + StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:26: +1:27 + return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 diff --git a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir index c5e2469fc27c..5cdf4fa46e39 100644 --- a/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir +++ b/tests/mir-opt/inline/unwrap_unchecked.unwrap_unchecked.PreCodegen.after.mir @@ -7,8 +7,9 @@ fn unwrap_unchecked(_1: Option) -> T { debug self => _1; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL let mut _2: &std::option::Option; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL let mut _3: isize; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + let _4: T; // in scope 1 at $SRC_DIR/core/src/option.rs:LL:COL scope 2 { - debug val => _0; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + debug val => _4; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL } scope 3 { scope 5 (inlined unreachable_unchecked) { // at $SRC_DIR/core/src/option.rs:LL:COL @@ -34,7 +35,10 @@ fn unwrap_unchecked(_1: Option) -> T { } bb2: { - _0 = move ((_1 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + StorageLive(_4); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + _4 = move ((_1 as Some).0: T); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL + _0 = move _4; // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL + StorageDead(_4); // scope 1 at $SRC_DIR/core/src/option.rs:LL:COL StorageDead(_2); // scope 0 at $DIR/unwrap_unchecked.rs:+1:9: +1:27 return; // scope 0 at $DIR/unwrap_unchecked.rs:+2:2: +2:2 } diff --git a/tests/mir-opt/nrvo_miscompile_111005.rs b/tests/mir-opt/nrvo_miscompile_111005.rs new file mode 100644 index 000000000000..a9f391b79d53 --- /dev/null +++ b/tests/mir-opt/nrvo_miscompile_111005.rs @@ -0,0 +1,22 @@ +// This is a miscompilation, #111005 to track + +// unit-test: RenameReturnPlace + +#![feature(custom_mir, core_intrinsics)] +extern crate core; +use core::intrinsics::mir::*; + +// EMIT_MIR nrvo_miscompile_111005.wrong.RenameReturnPlace.diff +#[custom_mir(dialect = "runtime", phase = "initial")] +pub fn wrong(arg: char) -> char { + mir!({ + let temp = arg; + RET = temp; + temp = 'b'; + Return() + }) +} + +fn main() { + assert_eq!(wrong('a'), 'a'); +} diff --git a/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff new file mode 100644 index 000000000000..a0acb6e7e119 --- /dev/null +++ b/tests/mir-opt/nrvo_miscompile_111005.wrong.RenameReturnPlace.diff @@ -0,0 +1,18 @@ +- // MIR for `wrong` before RenameReturnPlace ++ // MIR for `wrong` after RenameReturnPlace + + fn wrong(_1: char) -> char { +- let mut _0: char; // return place in scope 0 at $DIR/nrvo_miscompile_111005.rs:+0:28: +0:32 ++ let mut _0: char; // return place in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: char; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { +- _2 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL +- _0 = _2; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+3:9: +3:19 +- _2 = const 'b'; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+4:9: +4:19 ++ _0 = _1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL ++ _0 = const 'b'; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+4:9: +4:19 + return; // scope 0 at $DIR/nrvo_miscompile_111005.rs:+5:9: +5:17 + } + } + diff --git a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir index 2b4971e2ef91..4fddd50702c4 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.manual_replace.PreCodegen.after.mir @@ -3,14 +3,18 @@ fn manual_replace(_1: &mut u32, _2: u32) -> u32 { debug r => _1; // in scope 0 at $DIR/mem_replace.rs:+0:23: +0:24 debug v => _2; // in scope 0 at $DIR/mem_replace.rs:+0:36: +0:37 - let mut _0: u32; // return place in scope 0 at $DIR/mem_replace.rs:+1:9: +1:13 + let mut _0: u32; // return place in scope 0 at $DIR/mem_replace.rs:+0:47: +0:50 + let _3: u32; // in scope 0 at $DIR/mem_replace.rs:+1:9: +1:13 scope 1 { - debug temp => _0; // in scope 1 at $DIR/mem_replace.rs:+1:9: +1:13 + debug temp => _3; // in scope 1 at $DIR/mem_replace.rs:+1:9: +1:13 } bb0: { - _0 = (*_1); // scope 0 at $DIR/mem_replace.rs:+1:16: +1:18 + StorageLive(_3); // scope 0 at $DIR/mem_replace.rs:+1:9: +1:13 + _3 = (*_1); // scope 0 at $DIR/mem_replace.rs:+1:16: +1:18 (*_1) = _2; // scope 1 at $DIR/mem_replace.rs:+2:5: +2:11 + _0 = _3; // scope 1 at $DIR/mem_replace.rs:+3:5: +3:9 + StorageDead(_3); // scope 0 at $DIR/mem_replace.rs:+4:1: +4:2 return; // scope 0 at $DIR/mem_replace.rs:+4:2: +4:2 } } diff --git a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir index 50e0538c1336..619db12c48b3 100644 --- a/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/mem_replace.mem_replace.PreCodegen.after.mir @@ -7,28 +7,29 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { scope 1 (inlined std::mem::replace::) { // at $DIR/mem_replace.rs:16:5: 16:28 debug dest => _1; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL debug src => _2; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - let mut _3: *const u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - let mut _4: *mut u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + let mut _4: *const u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + let mut _5: *mut u32; // in scope 1 at $SRC_DIR/core/src/mem/mod.rs:LL:COL scope 2 { + let _3: u32; // in scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL scope 3 { - debug result => _0; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + debug result => _3; // in scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL scope 7 (inlined std::ptr::write::) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL - debug dst => _4; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug dst => _5; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL debug src => _2; // in scope 7 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _6: *mut u32; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _7: *mut u32; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 8 { scope 9 (inlined std::ptr::write::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug dst => _6; // in scope 9 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug dst => _7; // in scope 9 at $SRC_DIR/core/src/intrinsics.rs:LL:COL } } } } scope 4 (inlined std::ptr::read::) { // at $SRC_DIR/core/src/mem/mod.rs:LL:COL - debug src => _3; // in scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _5: *const u32; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug src => _4; // in scope 4 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + let mut _6: *const u32; // in scope 4 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 5 { scope 6 (inlined std::ptr::read::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug src => _5; // in scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug src => _6; // in scope 6 at $SRC_DIR/core/src/intrinsics.rs:LL:COL } } } @@ -37,17 +38,20 @@ fn mem_replace(_1: &mut u32, _2: u32) -> u32 { bb0: { StorageLive(_3); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - _3 = &raw const (*_1); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - StorageLive(_5); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - _0 = (*_3); // scope 5 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_5); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_4); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _4 = &raw const (*_1); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_6); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _3 = (*_4); // scope 5 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_6); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageDead(_4); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_5); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _5 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageLive(_7); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + (*_5) = _2; // scope 8 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + StorageDead(_7); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + StorageDead(_5); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL + _0 = move _3; // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL StorageDead(_3); // scope 2 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - StorageLive(_4); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - _4 = &raw mut (*_1); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - StorageLive(_6); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - (*_4) = _2; // scope 8 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_6); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL - StorageDead(_4); // scope 3 at $SRC_DIR/core/src/mem/mod.rs:LL:COL return; // scope 0 at $DIR/mem_replace.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir index ea0a44cf3bf7..7d4766ee5ccf 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_get_unchecked_mut_range.PreCodegen.after.mir @@ -3,66 +3,67 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> &mut [u32] { debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:45: +0:50 debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:64: +0:69 - let mut _0: &mut [u32]; // return place in scope 0 at $DIR/slice_index.rs:+1:5: +1:35 + let mut _0: &mut [u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:88: +0:98 scope 1 (inlined core::slice::::get_unchecked_mut::>) { // at $DIR/slice_index.rs:26:11: 26:35 debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - let mut _3: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _3: &mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL let mut _4: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + let mut _5: *mut [u32]; // in scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL scope 2 { scope 3 (inlined as SliceIndex<[u32]>>::get_unchecked_mut) { // at $SRC_DIR/core/src/slice/mod.rs:LL:COL debug self => _2; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug slice => _4; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let _5: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _7: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug slice => _5; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _6: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL let mut _8: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _9: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _9: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL let mut _10: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _11: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _11: *mut u32; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL let mut _12: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL - let mut _13: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - let mut _14: *mut [u32]; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _13: usize; // in scope 3 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let mut _14: std::ops::Range; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + let mut _15: *mut [u32]; // in scope 3 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 4 { - debug this => _5; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug this => _6; // in scope 4 at $SRC_DIR/core/src/slice/index.rs:LL:COL scope 5 { - let _6: usize; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _7: usize; // in scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL scope 6 { - debug new_len => _6; // in scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + debug new_len => _7; // in scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL scope 11 (inlined ptr::mut_ptr::::as_mut_ptr) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug self => _4; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _5; // in scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL } scope 12 (inlined ptr::mut_ptr::::add) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug self => _10; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug count => _11; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _11; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug count => _12; // in scope 12 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 13 { } } scope 14 (inlined slice_from_raw_parts_mut::) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug data => _9; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug len => _12; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - let mut _16: *mut (); // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug data => _10; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL + debug len => _13; // in scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL scope 15 (inlined ptr::mut_ptr::::cast::<()>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug self => _9; // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _10; // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _17: *mut (); // in scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL } scope 16 (inlined std::ptr::from_raw_parts_mut::<[u32]>) { // at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - debug data_address => _16; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - debug metadata => _12; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _17: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _18: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - let mut _19: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug data_address => _17; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug metadata => _13; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _18: std::ptr::metadata::PtrRepr<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _19: std::ptr::metadata::PtrComponents<[u32]>; // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + let mut _20: *const (); // in scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL scope 17 { } } } } scope 7 (inlined as SliceIndex<[T]>>::get_unchecked_mut::runtime::) { // at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug this => _13; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL - debug slice => _14; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug this => _14; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL + debug slice => _15; // in scope 7 at $SRC_DIR/core/src/intrinsics.rs:LL:COL scope 8 (inlined ptr::mut_ptr::::len) { // at $SRC_DIR/core/src/slice/index.rs:LL:COL - debug self => _14; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - let mut _15: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + debug self => _15; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + let mut _16: *const [u32]; // in scope 8 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL scope 9 (inlined std::ptr::metadata::<[u32]>) { // at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - debug ptr => _15; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + debug ptr => _16; // in scope 9 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL scope 10 { } } @@ -75,60 +76,61 @@ fn slice_get_unchecked_mut_range(_1: &mut [u32], _2: std::ops::Range) -> } bb0: { - StorageLive(_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageLive(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _4 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageLive(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _5 = &raw mut (*_1); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageLive(_6); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageLive(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageLive(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageLive(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_16); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageLive(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _7 = (_2.1: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageLive(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _8 = (_2.0: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _6 = unchecked_sub::(move _7, move _8) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _8 = (_2.1: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_9); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _9 = (_2.0: usize); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _7 = unchecked_sub::(move _8, move _9) -> [return: bb1, unwind unreachable]; // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(usize, usize) -> usize {unchecked_sub::}, val: Value() } } bb1: { + StorageDead(_9); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageDead(_8); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL StorageLive(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _10 = _4 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL StorageLive(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _11 = (_2.0: usize); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _9 = Offset(_10, _11); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageDead(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _11 = _5 as *mut u32 (PtrToPtr); // scope 11 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL StorageLive(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - _12 = _6; // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageLive(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - _16 = _9 as *mut () (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL - StorageLive(_17); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _12 = (_2.0: usize); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _10 = Offset(_11, _12); // scope 13 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL + StorageDead(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_11); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_13); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _13 = _7; // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_17); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _17 = _10 as *mut () (PtrToPtr); // scope 15 at $SRC_DIR/core/src/ptr/mut_ptr.rs:LL:COL StorageLive(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL StorageLive(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _19 = _16 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _18 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _19, metadata: _12 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageLive(_20); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _20 = _17 as *const () (Pointer(MutToConstPointer)); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _19 = ptr::metadata::PtrComponents::<[u32]> { data_address: move _20, metadata: _13 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_20); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + _18 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _19 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL StorageDead(_19); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _17 = ptr::metadata::PtrRepr::<[u32]> { const_ptr: move _18 }; // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_18); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - _3 = (_17.1: *mut [u32]); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_17); // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL - StorageDead(_16); // scope 14 at $SRC_DIR/core/src/ptr/mod.rs:LL:COL - StorageDead(_12); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_9); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL - StorageDead(_6); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _4 = (_18.1: *mut [u32]); // scope 17 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_18); // scope 16 at $SRC_DIR/core/src/ptr/metadata.rs:LL:COL + StorageDead(_17); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_13); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_10); // scope 6 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_7); // scope 5 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_16); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageDead(_15); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageDead(_14); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_13); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_6); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL StorageDead(_5); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - _0 = &mut (*_3); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL - StorageDead(_3); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _3 = &mut (*_4); // scope 2 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + StorageDead(_4); // scope 1 at $SRC_DIR/core/src/slice/mod.rs:LL:COL + _0 = _3; // scope 0 at $DIR/slice_index.rs:+1:5: +1:35 return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 } } diff --git a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir index 35dd973b55fa..d3b59e265b26 100644 --- a/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir +++ b/tests/mir-opt/pre-codegen/slice_index.slice_index_range.PreCodegen.after.mir @@ -3,24 +3,26 @@ fn slice_index_range(_1: &[u32], _2: std::ops::Range) -> &[u32] { debug slice => _1; // in scope 0 at $DIR/slice_index.rs:+0:26: +0:31 debug index => _2; // in scope 0 at $DIR/slice_index.rs:+0:41: +0:46 - let mut _0: &[u32]; // return place in scope 0 at $DIR/slice_index.rs:+1:5: +1:18 + let mut _0: &[u32]; // return place in scope 0 at $DIR/slice_index.rs:+0:65: +0:71 let _3: &[u32]; // in scope 0 at $DIR/slice_index.rs:+1:6: +1:18 scope 1 (inlined #[track_caller] core::slice::index::> for [u32]>::index) { // at $DIR/slice_index.rs:21:6: 21:18 debug self => _1; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL debug index => _2; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + let _4: &[u32]; // in scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL } bb0: { - StorageLive(_3); // scope 0 at $DIR/slice_index.rs:+1:6: +1:18 - _3 = as SliceIndex<[u32]>>::index(move _2, _1) -> bb1; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageLive(_4); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + _4 = as SliceIndex<[u32]>>::index(move _2, _1) -> bb1; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL // mir::Constant // + span: $SRC_DIR/core/src/slice/index.rs:LL:COL // + literal: Const { ty: for<'a> fn(std::ops::Range, &'a [u32]) -> &'a as SliceIndex<[u32]>>::Output { as SliceIndex<[u32]>>::index}, val: Value() } } bb1: { + _3 = _4; // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL + StorageDead(_4); // scope 1 at $SRC_DIR/core/src/slice/index.rs:LL:COL _0 = _3; // scope 0 at $DIR/slice_index.rs:+1:5: +1:18 - StorageDead(_3); // scope 0 at $DIR/slice_index.rs:+2:1: +2:2 return; // scope 0 at $DIR/slice_index.rs:+2:2: +2:2 } } From 3bbb69eaa02f5dfa6bcf23e667ec0614c64d3502 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 8 May 2023 16:04:20 +0200 Subject: [PATCH 80/97] Fix miscompilation when adding default method to `Future` --- compiler/rustc_ty_utils/src/instance.rs | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/compiler/rustc_ty_utils/src/instance.rs b/compiler/rustc_ty_utils/src/instance.rs index ec577072e196..eb3c21163ab2 100644 --- a/compiler/rustc_ty_utils/src/instance.rs +++ b/compiler/rustc_ty_utils/src/instance.rs @@ -194,21 +194,18 @@ fn resolve_associated_item<'tcx>( }) } traits::ImplSource::Future(future_data) => { - if cfg!(debug_assertions) && tcx.item_name(trait_item_id) != sym::poll { - // For compiler developers who'd like to add new items to `Future`, - // you either need to generate a shim body, or perhaps return - // `InstanceDef::Item` pointing to a trait default method body if - // it is given a default implementation by the trait. - span_bug!( - tcx.def_span(future_data.generator_def_id), - "no definition for `{trait_ref}::{}` for built-in async generator type", - tcx.item_name(trait_item_id) - ) + if Some(trait_item_id) == tcx.lang_items().future_poll_fn() { + // `Future::poll` is generated by the compiler. + Some(Instance { + def: ty::InstanceDef::Item(future_data.generator_def_id), + substs: future_data.substs, + }) + } else { + // All other methods are default methods of the `Future` trait. + // (this assumes that `ImplSource::Future` is only used for methods on `Future`) + debug_assert!(tcx.impl_defaultness(trait_item_id).has_value()); + Some(Instance::new(trait_item_id, rcvr_substs)) } - Some(Instance { - def: ty::InstanceDef::Item(future_data.generator_def_id), - substs: future_data.substs, - }) } traits::ImplSource::Closure(closure_data) => { if cfg!(debug_assertions) From bf7e07f627a3b183a944f90016e0e72100165e11 Mon Sep 17 00:00:00 2001 From: rustbot <47979223+rustbot@users.noreply.github.com> Date: Mon, 8 May 2023 13:00:54 -0400 Subject: [PATCH 81/97] Update books --- src/doc/edition-guide | 2 +- src/doc/embedded-book | 2 +- src/doc/reference | 2 +- src/doc/rust-by-example | 2 +- src/doc/rustc-dev-guide | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/doc/edition-guide b/src/doc/edition-guide index 6038be9d37d7..f63e578b92ff 160000 --- a/src/doc/edition-guide +++ b/src/doc/edition-guide @@ -1 +1 @@ -Subproject commit 6038be9d37d7251c966b486154af621d1794d7af +Subproject commit f63e578b92ff43e8cc38fcaa257b660f45c8a8c2 diff --git a/src/doc/embedded-book b/src/doc/embedded-book index 897fcf566f16..d9eb4c3f7543 160000 --- a/src/doc/embedded-book +++ b/src/doc/embedded-book @@ -1 +1 @@ -Subproject commit 897fcf566f16bf87bf37199bdddec1801fd00532 +Subproject commit d9eb4c3f75435b008881062ffa77bf0d1527b37d diff --git a/src/doc/reference b/src/doc/reference index 1f8dc727e94a..28dc0f3576b5 160000 --- a/src/doc/reference +++ b/src/doc/reference @@ -1 +1 @@ -Subproject commit 1f8dc727e94ae4ef92adf70df979521a1ea1143e +Subproject commit 28dc0f3576b55f5e57c5d6e65cd68ba3161e9fd5 diff --git a/src/doc/rust-by-example b/src/doc/rust-by-example index 31961fe22521..8ee9528b72b9 160000 --- a/src/doc/rust-by-example +++ b/src/doc/rust-by-example @@ -1 +1 @@ -Subproject commit 31961fe22521a779070a44a8f30a2b00a20b6212 +Subproject commit 8ee9528b72b927cff8fd32346db8bbd1198816f0 diff --git a/src/doc/rustc-dev-guide b/src/doc/rustc-dev-guide index 2a5eb92197e9..28dbeaf5c44b 160000 --- a/src/doc/rustc-dev-guide +++ b/src/doc/rustc-dev-guide @@ -1 +1 @@ -Subproject commit 2a5eb92197e9cf8fe91164dcbf4f9b88c0d7e73d +Subproject commit 28dbeaf5c44bc7f5111ad412e99f2d7c5cec6c90 From 02856110968903bf50a32184db200ccd9b6cc8b6 Mon Sep 17 00:00:00 2001 From: Caio Date: Mon, 8 May 2023 17:58:01 -0300 Subject: [PATCH 82/97] Move tests --- src/tools/tidy/src/ui_tests.rs | 2 +- tests/ui/{issues => closures}/issue-868.rs | 0 tests/ui/{issues => cycle-trait}/issue-12511.rs | 0 .../{issues => cycle-trait}/issue-12511.stderr | 0 tests/ui/{issues => deriving}/issue-15689-1.rs | 0 tests/ui/{issues => deriving}/issue-15689-2.rs | 0 tests/ui/{issues => drop}/issue-979.rs | 0 tests/ui/{issues => enum}/issue-1821.rs | 0 tests/ui/{issues => fn}/issue-3099.rs | 0 tests/ui/{issues => fn}/issue-3099.stderr | 0 tests/ui/{issues => inference}/issue-71584.rs | 0 .../ui/{issues => inference}/issue-71584.stderr | 0 tests/ui/issues/issue-2748-a.rs | 17 ----------------- tests/ui/{issues => macros}/issue-2804-2.rs | 0 tests/ui/{issues => nll}/issue-30438-a.rs | 0 tests/ui/{issues => nll}/issue-30438-a.stderr | 0 tests/ui/{issues => nll}/issue-30438-b.rs | 0 tests/ui/{issues => nll}/issue-30438-b.stderr | 0 tests/ui/{issues => nll}/issue-30438-c.rs | 0 tests/ui/{issues => nll}/issue-30438-c.stderr | 0 tests/ui/{issues => nll}/issue-54302-cases.rs | 0 .../ui/{issues => nll}/issue-54302-cases.stderr | 0 tests/ui/{issues => nll}/issue-54302.rs | 0 tests/ui/{issues => nll}/issue-54302.stderr | 0 tests/ui/{issues => reachable}/issue-948.rs | 0 tests/ui/{issues => resolve}/issue-3099-a.rs | 0 .../ui/{issues => resolve}/issue-3099-a.stderr | 0 tests/ui/{issues => resolve}/issue-3099-b.rs | 0 .../ui/{issues => resolve}/issue-3099-b.stderr | 0 .../ui/{issues => test-attrs}/issue-12997-1.rs | 0 .../{issues => test-attrs}/issue-12997-1.stderr | 0 .../ui/{issues => test-attrs}/issue-12997-2.rs | 0 .../{issues => test-attrs}/issue-12997-2.stderr | 0 tests/ui/{issues => test-attrs}/issue-34932.rs | 0 34 files changed, 1 insertion(+), 18 deletions(-) rename tests/ui/{issues => closures}/issue-868.rs (100%) rename tests/ui/{issues => cycle-trait}/issue-12511.rs (100%) rename tests/ui/{issues => cycle-trait}/issue-12511.stderr (100%) rename tests/ui/{issues => deriving}/issue-15689-1.rs (100%) rename tests/ui/{issues => deriving}/issue-15689-2.rs (100%) rename tests/ui/{issues => drop}/issue-979.rs (100%) rename tests/ui/{issues => enum}/issue-1821.rs (100%) rename tests/ui/{issues => fn}/issue-3099.rs (100%) rename tests/ui/{issues => fn}/issue-3099.stderr (100%) rename tests/ui/{issues => inference}/issue-71584.rs (100%) rename tests/ui/{issues => inference}/issue-71584.stderr (100%) delete mode 100644 tests/ui/issues/issue-2748-a.rs rename tests/ui/{issues => macros}/issue-2804-2.rs (100%) rename tests/ui/{issues => nll}/issue-30438-a.rs (100%) rename tests/ui/{issues => nll}/issue-30438-a.stderr (100%) rename tests/ui/{issues => nll}/issue-30438-b.rs (100%) rename tests/ui/{issues => nll}/issue-30438-b.stderr (100%) rename tests/ui/{issues => nll}/issue-30438-c.rs (100%) rename tests/ui/{issues => nll}/issue-30438-c.stderr (100%) rename tests/ui/{issues => nll}/issue-54302-cases.rs (100%) rename tests/ui/{issues => nll}/issue-54302-cases.stderr (100%) rename tests/ui/{issues => nll}/issue-54302.rs (100%) rename tests/ui/{issues => nll}/issue-54302.stderr (100%) rename tests/ui/{issues => reachable}/issue-948.rs (100%) rename tests/ui/{issues => resolve}/issue-3099-a.rs (100%) rename tests/ui/{issues => resolve}/issue-3099-a.stderr (100%) rename tests/ui/{issues => resolve}/issue-3099-b.rs (100%) rename tests/ui/{issues => resolve}/issue-3099-b.stderr (100%) rename tests/ui/{issues => test-attrs}/issue-12997-1.rs (100%) rename tests/ui/{issues => test-attrs}/issue-12997-1.stderr (100%) rename tests/ui/{issues => test-attrs}/issue-12997-2.rs (100%) rename tests/ui/{issues => test-attrs}/issue-12997-2.stderr (100%) rename tests/ui/{issues => test-attrs}/issue-34932.rs (100%) diff --git a/src/tools/tidy/src/ui_tests.rs b/src/tools/tidy/src/ui_tests.rs index e4f328ec0ddc..9473eabe442c 100644 --- a/src/tools/tidy/src/ui_tests.rs +++ b/src/tools/tidy/src/ui_tests.rs @@ -9,7 +9,7 @@ use std::path::{Path, PathBuf}; const ENTRY_LIMIT: usize = 900; // FIXME: The following limits should be reduced eventually. -const ISSUES_ENTRY_LIMIT: usize = 1953; +const ISSUES_ENTRY_LIMIT: usize = 1920; const ROOT_ENTRY_LIMIT: usize = 895; fn check_entries(tests_path: &Path, bad: &mut bool) { diff --git a/tests/ui/issues/issue-868.rs b/tests/ui/closures/issue-868.rs similarity index 100% rename from tests/ui/issues/issue-868.rs rename to tests/ui/closures/issue-868.rs diff --git a/tests/ui/issues/issue-12511.rs b/tests/ui/cycle-trait/issue-12511.rs similarity index 100% rename from tests/ui/issues/issue-12511.rs rename to tests/ui/cycle-trait/issue-12511.rs diff --git a/tests/ui/issues/issue-12511.stderr b/tests/ui/cycle-trait/issue-12511.stderr similarity index 100% rename from tests/ui/issues/issue-12511.stderr rename to tests/ui/cycle-trait/issue-12511.stderr diff --git a/tests/ui/issues/issue-15689-1.rs b/tests/ui/deriving/issue-15689-1.rs similarity index 100% rename from tests/ui/issues/issue-15689-1.rs rename to tests/ui/deriving/issue-15689-1.rs diff --git a/tests/ui/issues/issue-15689-2.rs b/tests/ui/deriving/issue-15689-2.rs similarity index 100% rename from tests/ui/issues/issue-15689-2.rs rename to tests/ui/deriving/issue-15689-2.rs diff --git a/tests/ui/issues/issue-979.rs b/tests/ui/drop/issue-979.rs similarity index 100% rename from tests/ui/issues/issue-979.rs rename to tests/ui/drop/issue-979.rs diff --git a/tests/ui/issues/issue-1821.rs b/tests/ui/enum/issue-1821.rs similarity index 100% rename from tests/ui/issues/issue-1821.rs rename to tests/ui/enum/issue-1821.rs diff --git a/tests/ui/issues/issue-3099.rs b/tests/ui/fn/issue-3099.rs similarity index 100% rename from tests/ui/issues/issue-3099.rs rename to tests/ui/fn/issue-3099.rs diff --git a/tests/ui/issues/issue-3099.stderr b/tests/ui/fn/issue-3099.stderr similarity index 100% rename from tests/ui/issues/issue-3099.stderr rename to tests/ui/fn/issue-3099.stderr diff --git a/tests/ui/issues/issue-71584.rs b/tests/ui/inference/issue-71584.rs similarity index 100% rename from tests/ui/issues/issue-71584.rs rename to tests/ui/inference/issue-71584.rs diff --git a/tests/ui/issues/issue-71584.stderr b/tests/ui/inference/issue-71584.stderr similarity index 100% rename from tests/ui/issues/issue-71584.stderr rename to tests/ui/inference/issue-71584.stderr diff --git a/tests/ui/issues/issue-2748-a.rs b/tests/ui/issues/issue-2748-a.rs deleted file mode 100644 index cbb9bcc28ac8..000000000000 --- a/tests/ui/issues/issue-2748-a.rs +++ /dev/null @@ -1,17 +0,0 @@ -// build-pass -#![allow(dead_code)] -#![allow(non_snake_case)] - -// pretty-expanded FIXME #23616 - -struct CMap<'a> { - buf: &'a [u8], -} - -fn CMap(buf: &[u8]) -> CMap { - CMap { - buf: buf - } -} - -pub fn main() { } diff --git a/tests/ui/issues/issue-2804-2.rs b/tests/ui/macros/issue-2804-2.rs similarity index 100% rename from tests/ui/issues/issue-2804-2.rs rename to tests/ui/macros/issue-2804-2.rs diff --git a/tests/ui/issues/issue-30438-a.rs b/tests/ui/nll/issue-30438-a.rs similarity index 100% rename from tests/ui/issues/issue-30438-a.rs rename to tests/ui/nll/issue-30438-a.rs diff --git a/tests/ui/issues/issue-30438-a.stderr b/tests/ui/nll/issue-30438-a.stderr similarity index 100% rename from tests/ui/issues/issue-30438-a.stderr rename to tests/ui/nll/issue-30438-a.stderr diff --git a/tests/ui/issues/issue-30438-b.rs b/tests/ui/nll/issue-30438-b.rs similarity index 100% rename from tests/ui/issues/issue-30438-b.rs rename to tests/ui/nll/issue-30438-b.rs diff --git a/tests/ui/issues/issue-30438-b.stderr b/tests/ui/nll/issue-30438-b.stderr similarity index 100% rename from tests/ui/issues/issue-30438-b.stderr rename to tests/ui/nll/issue-30438-b.stderr diff --git a/tests/ui/issues/issue-30438-c.rs b/tests/ui/nll/issue-30438-c.rs similarity index 100% rename from tests/ui/issues/issue-30438-c.rs rename to tests/ui/nll/issue-30438-c.rs diff --git a/tests/ui/issues/issue-30438-c.stderr b/tests/ui/nll/issue-30438-c.stderr similarity index 100% rename from tests/ui/issues/issue-30438-c.stderr rename to tests/ui/nll/issue-30438-c.stderr diff --git a/tests/ui/issues/issue-54302-cases.rs b/tests/ui/nll/issue-54302-cases.rs similarity index 100% rename from tests/ui/issues/issue-54302-cases.rs rename to tests/ui/nll/issue-54302-cases.rs diff --git a/tests/ui/issues/issue-54302-cases.stderr b/tests/ui/nll/issue-54302-cases.stderr similarity index 100% rename from tests/ui/issues/issue-54302-cases.stderr rename to tests/ui/nll/issue-54302-cases.stderr diff --git a/tests/ui/issues/issue-54302.rs b/tests/ui/nll/issue-54302.rs similarity index 100% rename from tests/ui/issues/issue-54302.rs rename to tests/ui/nll/issue-54302.rs diff --git a/tests/ui/issues/issue-54302.stderr b/tests/ui/nll/issue-54302.stderr similarity index 100% rename from tests/ui/issues/issue-54302.stderr rename to tests/ui/nll/issue-54302.stderr diff --git a/tests/ui/issues/issue-948.rs b/tests/ui/reachable/issue-948.rs similarity index 100% rename from tests/ui/issues/issue-948.rs rename to tests/ui/reachable/issue-948.rs diff --git a/tests/ui/issues/issue-3099-a.rs b/tests/ui/resolve/issue-3099-a.rs similarity index 100% rename from tests/ui/issues/issue-3099-a.rs rename to tests/ui/resolve/issue-3099-a.rs diff --git a/tests/ui/issues/issue-3099-a.stderr b/tests/ui/resolve/issue-3099-a.stderr similarity index 100% rename from tests/ui/issues/issue-3099-a.stderr rename to tests/ui/resolve/issue-3099-a.stderr diff --git a/tests/ui/issues/issue-3099-b.rs b/tests/ui/resolve/issue-3099-b.rs similarity index 100% rename from tests/ui/issues/issue-3099-b.rs rename to tests/ui/resolve/issue-3099-b.rs diff --git a/tests/ui/issues/issue-3099-b.stderr b/tests/ui/resolve/issue-3099-b.stderr similarity index 100% rename from tests/ui/issues/issue-3099-b.stderr rename to tests/ui/resolve/issue-3099-b.stderr diff --git a/tests/ui/issues/issue-12997-1.rs b/tests/ui/test-attrs/issue-12997-1.rs similarity index 100% rename from tests/ui/issues/issue-12997-1.rs rename to tests/ui/test-attrs/issue-12997-1.rs diff --git a/tests/ui/issues/issue-12997-1.stderr b/tests/ui/test-attrs/issue-12997-1.stderr similarity index 100% rename from tests/ui/issues/issue-12997-1.stderr rename to tests/ui/test-attrs/issue-12997-1.stderr diff --git a/tests/ui/issues/issue-12997-2.rs b/tests/ui/test-attrs/issue-12997-2.rs similarity index 100% rename from tests/ui/issues/issue-12997-2.rs rename to tests/ui/test-attrs/issue-12997-2.rs diff --git a/tests/ui/issues/issue-12997-2.stderr b/tests/ui/test-attrs/issue-12997-2.stderr similarity index 100% rename from tests/ui/issues/issue-12997-2.stderr rename to tests/ui/test-attrs/issue-12997-2.stderr diff --git a/tests/ui/issues/issue-34932.rs b/tests/ui/test-attrs/issue-34932.rs similarity index 100% rename from tests/ui/issues/issue-34932.rs rename to tests/ui/test-attrs/issue-34932.rs From e315bbf736acc6408955f48e2effb1645bf1a022 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 8 May 2023 21:43:03 +0000 Subject: [PATCH 83/97] test for reachable private impl --- .../reachable/auxiliary/foreign-priv-aux.rs | 21 +++++++++++++++++++ tests/ui/reachable/foreign-priv.rs | 12 +++++++++++ 2 files changed, 33 insertions(+) create mode 100644 tests/ui/reachable/auxiliary/foreign-priv-aux.rs create mode 100644 tests/ui/reachable/foreign-priv.rs diff --git a/tests/ui/reachable/auxiliary/foreign-priv-aux.rs b/tests/ui/reachable/auxiliary/foreign-priv-aux.rs new file mode 100644 index 000000000000..10dc08614613 --- /dev/null +++ b/tests/ui/reachable/auxiliary/foreign-priv-aux.rs @@ -0,0 +1,21 @@ +trait PrivTrait { + fn priv_fn(&self); +} + +pub struct ImplPrivTrait; + +impl PrivTrait for ImplPrivTrait { + fn priv_fn(&self) {} +} + +pub struct Wrapper(T); + +pub trait PubTrait { + fn pub_fn(&self); +} + +impl PubTrait for Wrapper { + fn pub_fn(&self) { + self.0.priv_fn() + } +} diff --git a/tests/ui/reachable/foreign-priv.rs b/tests/ui/reachable/foreign-priv.rs new file mode 100644 index 000000000000..bf336b6be7ab --- /dev/null +++ b/tests/ui/reachable/foreign-priv.rs @@ -0,0 +1,12 @@ +// aux-build:foreign-priv-aux.rs +// build-pass + +#![crate_type = "lib"] + +extern crate foreign_priv_aux; + +use foreign_priv_aux::{ImplPrivTrait, PubTrait, Wrapper}; + +pub fn foo(x: Wrapper) { + x.pub_fn(); +} From 5fcf2e6edc07e38e24201146be9fb58fe6cd72a0 Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Mon, 8 May 2023 21:28:21 +0000 Subject: [PATCH 84/97] Revert "Populate effective visibilities in `rustc_privacy`" This reverts commit cff85f22f5030fbe7266d272da74a9e76160523c. --- compiler/rustc_middle/src/middle/privacy.rs | 45 +-- compiler/rustc_privacy/src/lib.rs | 267 ++++++++---------- .../src/effective_visibilities.rs | 4 +- library/core/src/iter/adapters/flatten.rs | 6 - 4 files changed, 143 insertions(+), 179 deletions(-) diff --git a/compiler/rustc_middle/src/middle/privacy.rs b/compiler/rustc_middle/src/middle/privacy.rs index aeb6a1601fc2..967fed687b6a 100644 --- a/compiler/rustc_middle/src/middle/privacy.rs +++ b/compiler/rustc_middle/src/middle/privacy.rs @@ -64,7 +64,7 @@ impl EffectiveVisibility { self.at_level(level).is_public() } - pub const fn from_vis(vis: Visibility) -> EffectiveVisibility { + pub fn from_vis(vis: Visibility) -> EffectiveVisibility { EffectiveVisibility { direct: vis, reexported: vis, @@ -72,18 +72,6 @@ impl EffectiveVisibility { reachable_through_impl_trait: vis, } } - - #[must_use] - pub fn min(mut self, lhs: EffectiveVisibility, tcx: TyCtxt<'_>) -> Self { - for l in Level::all_levels() { - let rhs_vis = self.at_level_mut(l); - let lhs_vis = *lhs.at_level(l); - if rhs_vis.is_at_least(lhs_vis, tcx) { - *rhs_vis = lhs_vis; - }; - } - self - } } /// Holds a map of effective visibilities for reachable HIR nodes. @@ -149,6 +137,24 @@ impl EffectiveVisibilities { }; } + pub fn set_public_at_level( + &mut self, + id: LocalDefId, + lazy_private_vis: impl FnOnce() -> Visibility, + level: Level, + ) { + let mut effective_vis = self + .effective_vis(id) + .copied() + .unwrap_or_else(|| EffectiveVisibility::from_vis(lazy_private_vis())); + for l in Level::all_levels() { + if l <= level { + *effective_vis.at_level_mut(l) = Visibility::Public; + } + } + self.map.insert(id, effective_vis); + } + pub fn check_invariants(&self, tcx: TyCtxt<'_>, early: bool) { if !cfg!(debug_assertions) { return; @@ -213,7 +219,7 @@ impl EffectiveVisibilities { pub fn update( &mut self, id: Id, - nominal_vis: Option, + nominal_vis: Visibility, lazy_private_vis: impl FnOnce() -> Visibility, inherited_effective_vis: EffectiveVisibility, level: Level, @@ -237,11 +243,12 @@ impl EffectiveVisibilities { if !(inherited_effective_vis_at_prev_level == inherited_effective_vis_at_level && level != l) { - calculated_effective_vis = if let Some(nominal_vis) = nominal_vis && !nominal_vis.is_at_least(inherited_effective_vis_at_level, tcx) { - nominal_vis - } else { - inherited_effective_vis_at_level - } + calculated_effective_vis = + if nominal_vis.is_at_least(inherited_effective_vis_at_level, tcx) { + inherited_effective_vis_at_level + } else { + nominal_vis + }; } // effective visibility can't be decreased at next update call for the // same id diff --git a/compiler/rustc_privacy/src/lib.rs b/compiler/rustc_privacy/src/lib.rs index b738ce35ada8..04ac585076f9 100644 --- a/compiler/rustc_privacy/src/lib.rs +++ b/compiler/rustc_privacy/src/lib.rs @@ -25,7 +25,7 @@ use rustc_hir::intravisit::{self, Visitor}; use rustc_hir::{AssocItemKind, HirIdSet, ItemId, Node, PatKind}; use rustc_middle::bug; use rustc_middle::hir::nested_filter; -use rustc_middle::middle::privacy::{EffectiveVisibilities, EffectiveVisibility, Level}; +use rustc_middle::middle::privacy::{EffectiveVisibilities, Level}; use rustc_middle::span_bug; use rustc_middle::ty::query::Providers; use rustc_middle::ty::subst::InternalSubsts; @@ -38,7 +38,7 @@ use rustc_span::Span; use std::marker::PhantomData; use std::ops::ControlFlow; -use std::{fmt, mem}; +use std::{cmp, fmt, mem}; use errors::{ FieldIsPrivate, FieldIsPrivateLabel, FromPrivateDependencyInPublicInterface, InPublicInterface, @@ -375,9 +375,8 @@ impl VisibilityLike for ty::Visibility { min(find.tcx.local_visibility(def_id), find.min, find.tcx) } } - -impl VisibilityLike for Option { - const MAX: Self = Some(EffectiveVisibility::from_vis(ty::Visibility::Public)); +impl VisibilityLike for Option { + const MAX: Self = Some(Level::Direct); // Type inference is very smart sometimes. // It can make an impl reachable even some components of its type or trait are unreachable. // E.g. methods of `impl ReachableTrait for ReachableTy { ... }` @@ -389,13 +388,7 @@ impl VisibilityLike for Option { // (which require reaching the `DefId`s in them). const SHALLOW: bool = true; fn new_min(find: &FindMin<'_, '_, Self>, def_id: LocalDefId) -> Self { - if let Some(min) = find.min { - return find - .effective_visibilities - .effective_vis(def_id) - .map(|eff_vis| min.min(*eff_vis, find.tcx)); - } - None + cmp::min(find.effective_visibilities.public_at_level(def_id), find.min) } } @@ -421,79 +414,49 @@ struct EmbargoVisitor<'tcx> { /// n::p::f() /// } macro_reachable: FxHashSet<(LocalDefId, LocalDefId)>, + /// Previous visibility level; `None` means unreachable. + prev_level: Option, /// Has something changed in the level map? changed: bool, } struct ReachEverythingInTheInterfaceVisitor<'a, 'tcx> { - effective_vis: Option, + level: Option, item_def_id: LocalDefId, ev: &'a mut EmbargoVisitor<'tcx>, - level: Level, } impl<'tcx> EmbargoVisitor<'tcx> { - fn get(&self, def_id: LocalDefId) -> Option { - self.effective_visibilities.effective_vis(def_id).copied() + fn get(&self, def_id: LocalDefId) -> Option { + self.effective_visibilities.public_at_level(def_id) } - // Updates node effective visibility. - fn update( - &mut self, - def_id: LocalDefId, - inherited_effective_vis: Option, - level: Level, - ) { - let nominal_vis = self.tcx.local_visibility(def_id); - self.update_eff_vis(def_id, inherited_effective_vis, Some(nominal_vis), level); - } - - fn update_eff_vis( - &mut self, - def_id: LocalDefId, - inherited_effective_vis: Option, - nominal_vis: Option, - level: Level, - ) { - if let Some(inherited_effective_vis) = inherited_effective_vis { - let private_vis = - ty::Visibility::Restricted(self.tcx.parent_module_from_def_id(def_id)); - if Some(private_vis) != nominal_vis { - self.changed |= self.effective_visibilities.update( - def_id, - nominal_vis, - || private_vis, - inherited_effective_vis, - level, - self.tcx, - ); - } + /// Updates node level and returns the updated level. + fn update(&mut self, def_id: LocalDefId, level: Option) -> Option { + let old_level = self.get(def_id); + // Visibility levels can only grow. + if level > old_level { + self.effective_visibilities.set_public_at_level( + def_id, + || ty::Visibility::Restricted(self.tcx.parent_module_from_def_id(def_id)), + level.unwrap(), + ); + self.changed = true; + level + } else { + old_level } } fn reach( &mut self, def_id: LocalDefId, - effective_vis: Option, + level: Option, ) -> ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { ReachEverythingInTheInterfaceVisitor { - effective_vis, + level: cmp::min(level, Some(Level::Reachable)), item_def_id: def_id, ev: self, - level: Level::Reachable, - } - } - - fn reach_through_impl_trait( - &mut self, - def_id: LocalDefId, - effective_vis: Option, - ) -> ReachEverythingInTheInterfaceVisitor<'_, 'tcx> { - ReachEverythingInTheInterfaceVisitor { - effective_vis, - item_def_id: def_id, - ev: self, - level: Level::ReachableThroughImplTrait, } } @@ -514,18 +477,16 @@ impl<'tcx> EmbargoVisitor<'tcx> { return; } - if self.effective_visibilities.public_at_level(local_def_id).is_none() { + if self.get(local_def_id).is_none() { return; } // Since we are starting from an externally visible module, // all the parents in the loop below are also guaranteed to be modules. let mut module_def_id = macro_module_def_id; - let macro_ev = self.get(local_def_id); - assert!(macro_ev.is_some()); loop { let changed_reachability = - self.update_macro_reachable(module_def_id, macro_module_def_id, macro_ev); + self.update_macro_reachable(module_def_id, macro_module_def_id); if changed_reachability || module_def_id == CRATE_DEF_ID { break; } @@ -539,33 +500,21 @@ impl<'tcx> EmbargoVisitor<'tcx> { &mut self, module_def_id: LocalDefId, defining_mod: LocalDefId, - macro_ev: Option, ) -> bool { if self.macro_reachable.insert((module_def_id, defining_mod)) { - self.update_macro_reachable_mod(module_def_id, defining_mod, macro_ev); + self.update_macro_reachable_mod(module_def_id, defining_mod); true } else { false } } - fn update_macro_reachable_mod( - &mut self, - module_def_id: LocalDefId, - defining_mod: LocalDefId, - macro_ev: Option, - ) { + fn update_macro_reachable_mod(&mut self, module_def_id: LocalDefId, defining_mod: LocalDefId) { let module = self.tcx.hir().get_module(module_def_id).0; for item_id in module.item_ids { let def_kind = self.tcx.def_kind(item_id.owner_id); let vis = self.tcx.local_visibility(item_id.owner_id.def_id); - self.update_macro_reachable_def( - item_id.owner_id.def_id, - def_kind, - vis, - defining_mod, - macro_ev, - ); + self.update_macro_reachable_def(item_id.owner_id.def_id, def_kind, vis, defining_mod); } for child in self.tcx.module_children_local(module_def_id) { // FIXME: Use module children for the logic above too. @@ -574,7 +523,7 @@ impl<'tcx> EmbargoVisitor<'tcx> { && let Res::Def(def_kind, def_id) = child.res && let Some(def_id) = def_id.as_local() { let vis = self.tcx.local_visibility(def_id); - self.update_macro_reachable_def(def_id, def_kind, vis, defining_mod, macro_ev); + self.update_macro_reachable_def(def_id, def_kind, vis, defining_mod); } } } @@ -585,14 +534,16 @@ impl<'tcx> EmbargoVisitor<'tcx> { def_kind: DefKind, vis: ty::Visibility, module: LocalDefId, - macro_ev: Option, ) { - self.update(def_id, macro_ev, Level::Reachable); + let level = Some(Level::Reachable); + if vis.is_public() { + self.update(def_id, level); + } match def_kind { // No type privacy, so can be directly marked as reachable. DefKind::Const | DefKind::Static(_) | DefKind::TraitAlias | DefKind::TyAlias => { if vis.is_accessible_from(module, self.tcx) { - self.update(def_id, macro_ev, Level::Reachable); + self.update(def_id, level); } } @@ -604,7 +555,7 @@ impl<'tcx> EmbargoVisitor<'tcx> { let item = self.tcx.hir().expect_item(def_id); if let hir::ItemKind::Macro(MacroDef { macro_rules: false, .. }, _) = item.kind { if vis.is_accessible_from(module, self.tcx) { - self.update(def_id, macro_ev, Level::Reachable); + self.update(def_id, level); } } } @@ -615,24 +566,26 @@ impl<'tcx> EmbargoVisitor<'tcx> { // the module, however may be reachable. DefKind::Mod => { if vis.is_accessible_from(module, self.tcx) { - self.update_macro_reachable(def_id, module, macro_ev); + self.update_macro_reachable(def_id, module); } } DefKind::Struct | DefKind::Union => { // While structs and unions have type privacy, their fields do not. - let item = self.tcx.hir().expect_item(def_id); - if let hir::ItemKind::Struct(ref struct_def, _) - | hir::ItemKind::Union(ref struct_def, _) = item.kind - { - for field in struct_def.fields() { - let field_vis = self.tcx.local_visibility(field.def_id); - if field_vis.is_accessible_from(module, self.tcx) { - self.reach(field.def_id, macro_ev).ty(); + if vis.is_public() { + let item = self.tcx.hir().expect_item(def_id); + if let hir::ItemKind::Struct(ref struct_def, _) + | hir::ItemKind::Union(ref struct_def, _) = item.kind + { + for field in struct_def.fields() { + let field_vis = self.tcx.local_visibility(field.def_id); + if field_vis.is_accessible_from(module, self.tcx) { + self.reach(field.def_id, level).ty(); + } } + } else { + bug!("item {:?} with DefKind {:?}", item, def_kind); } - } else { - bug!("item {:?} with DefKind {:?}", item, def_kind); } } @@ -676,16 +629,14 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { } fn visit_item(&mut self, item: &'tcx hir::Item<'tcx>) { - let item_ev = match item.kind { + let item_level = match item.kind { hir::ItemKind::Impl { .. } => { - let impl_ev = Option::::of_impl( + let impl_level = Option::::of_impl( item.owner_id.def_id, self.tcx, &self.effective_visibilities, ); - - self.update_eff_vis(item.owner_id.def_id, impl_ev, None, Level::Direct); - impl_ev + self.update(item.owner_id.def_id, impl_level) } _ => self.get(item.owner_id.def_id), }; @@ -694,32 +645,38 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { match item.kind { hir::ItemKind::Enum(ref def, _) => { for variant in def.variants { - self.update(variant.def_id, item_ev, Level::Reachable); - let variant_ev = self.get(variant.def_id); + let variant_level = self.update(variant.def_id, item_level); if let Some(ctor_def_id) = variant.data.ctor_def_id() { - self.update(ctor_def_id, variant_ev, Level::Reachable); + self.update(ctor_def_id, item_level); } for field in variant.data.fields() { - self.update(field.def_id, variant_ev, Level::Reachable); + self.update(field.def_id, variant_level); } } } hir::ItemKind::Impl(ref impl_) => { for impl_item_ref in impl_.items { - self.update(impl_item_ref.id.owner_id.def_id, item_ev, Level::Direct); + if impl_.of_trait.is_some() + || self.tcx.visibility(impl_item_ref.id.owner_id).is_public() + { + self.update(impl_item_ref.id.owner_id.def_id, item_level); + } } } hir::ItemKind::Trait(.., trait_item_refs) => { for trait_item_ref in trait_item_refs { - self.update(trait_item_ref.id.owner_id.def_id, item_ev, Level::Reachable); + self.update(trait_item_ref.id.owner_id.def_id, item_level); } } hir::ItemKind::Struct(ref def, _) | hir::ItemKind::Union(ref def, _) => { if let Some(ctor_def_id) = def.ctor_def_id() { - self.update(ctor_def_id, item_ev, Level::Reachable); + self.update(ctor_def_id, item_level); } for field in def.fields() { - self.update(field.def_id, item_ev, Level::Reachable); + let vis = self.tcx.visibility(field.def_id); + if vis.is_public() { + self.update(field.def_id, item_level); + } } } hir::ItemKind::Macro(ref macro_def, _) => { @@ -727,7 +684,9 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { } hir::ItemKind::ForeignMod { items, .. } => { for foreign_item in items { - self.update(foreign_item.id.owner_id.def_id, item_ev, Level::Reachable); + if self.tcx.visibility(foreign_item.id.owner_id).is_public() { + self.update(foreign_item.id.owner_id.def_id, item_level); + } } } @@ -762,11 +721,8 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { // FIXME: This is some serious pessimization intended to workaround deficiencies // in the reachability pass (`middle/reachable.rs`). Types are marked as link-time // reachable if they are returned via `impl Trait`, even from private functions. - let exist_ev = Some(EffectiveVisibility::from_vis(ty::Visibility::Public)); - self.reach_through_impl_trait(item.owner_id.def_id, exist_ev) - .generics() - .predicates() - .ty(); + let exist_level = cmp::max(item_level, Some(Level::ReachableThroughImplTrait)); + self.reach(item.owner_id.def_id, exist_level).generics().predicates().ty(); } } // Visit everything. @@ -774,18 +730,17 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { | hir::ItemKind::Static(..) | hir::ItemKind::Fn(..) | hir::ItemKind::TyAlias(..) => { - if item_ev.is_some() { - self.reach(item.owner_id.def_id, item_ev).generics().predicates().ty(); + if item_level.is_some() { + self.reach(item.owner_id.def_id, item_level).generics().predicates().ty(); } } hir::ItemKind::Trait(.., trait_item_refs) => { - if item_ev.is_some() { - self.reach(item.owner_id.def_id, item_ev).generics().predicates(); + if item_level.is_some() { + self.reach(item.owner_id.def_id, item_level).generics().predicates(); for trait_item_ref in trait_item_refs { let tcx = self.tcx; - let mut reach = self.reach(trait_item_ref.id.owner_id.def_id, item_ev); - + let mut reach = self.reach(trait_item_ref.id.owner_id.def_id, item_level); reach.generics().predicates(); if trait_item_ref.kind == AssocItemKind::Type @@ -799,24 +754,23 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { } } hir::ItemKind::TraitAlias(..) => { - if item_ev.is_some() { - self.reach(item.owner_id.def_id, item_ev).generics().predicates(); + if item_level.is_some() { + self.reach(item.owner_id.def_id, item_level).generics().predicates(); } } // Visit everything except for private impl items. hir::ItemKind::Impl(ref impl_) => { - if item_ev.is_some() { - self.reach(item.owner_id.def_id, item_ev) + if item_level.is_some() { + self.reach(item.owner_id.def_id, item_level) .generics() .predicates() .ty() .trait_ref(); for impl_item_ref in impl_.items { - let impl_item_ev = self.get(impl_item_ref.id.owner_id.def_id); - - if impl_item_ev.is_some() { - self.reach(impl_item_ref.id.owner_id.def_id, impl_item_ev) + let impl_item_level = self.get(impl_item_ref.id.owner_id.def_id); + if impl_item_level.is_some() { + self.reach(impl_item_ref.id.owner_id.def_id, impl_item_level) .generics() .predicates() .ty(); @@ -827,23 +781,23 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { // Visit everything, but enum variants have their own levels. hir::ItemKind::Enum(ref def, _) => { - if item_ev.is_some() { - self.reach(item.owner_id.def_id, item_ev).generics().predicates(); + if item_level.is_some() { + self.reach(item.owner_id.def_id, item_level).generics().predicates(); } for variant in def.variants { - let variant_ev = self.get(variant.def_id); - if variant_ev.is_some() { + let variant_level = self.get(variant.def_id); + if variant_level.is_some() { for field in variant.data.fields() { - self.reach(field.def_id, variant_ev).ty(); + self.reach(field.def_id, variant_level).ty(); } // Corner case: if the variant is reachable, but its // enum is not, make the enum reachable as well. - self.reach(item.owner_id.def_id, variant_ev).ty(); + self.reach(item.owner_id.def_id, variant_level).ty(); } if let Some(ctor_def_id) = variant.data.ctor_def_id() { - let ctor_ev = self.get(ctor_def_id); - if ctor_ev.is_some() { - self.reach(item.owner_id.def_id, ctor_ev).ty(); + let ctor_level = self.get(ctor_def_id); + if ctor_level.is_some() { + self.reach(item.owner_id.def_id, ctor_level).ty(); } } } @@ -851,9 +805,9 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { // Visit everything, but foreign items have their own levels. hir::ItemKind::ForeignMod { items, .. } => { for foreign_item in items { - let foreign_item_ev = self.get(foreign_item.id.owner_id.def_id); - if foreign_item_ev.is_some() { - self.reach(foreign_item.id.owner_id.def_id, foreign_item_ev) + let foreign_item_level = self.get(foreign_item.id.owner_id.def_id); + if foreign_item_level.is_some() { + self.reach(foreign_item.id.owner_id.def_id, foreign_item_level) .generics() .predicates() .ty(); @@ -862,32 +816,36 @@ impl<'tcx> Visitor<'tcx> for EmbargoVisitor<'tcx> { } // Visit everything except for private fields. hir::ItemKind::Struct(ref struct_def, _) | hir::ItemKind::Union(ref struct_def, _) => { - if item_ev.is_some() { - self.reach(item.owner_id.def_id, item_ev).generics().predicates(); + if item_level.is_some() { + self.reach(item.owner_id.def_id, item_level).generics().predicates(); for field in struct_def.fields() { - let field_ev = self.get(field.def_id); - if field_ev.is_some() { - self.reach(field.def_id, field_ev).ty(); + let field_level = self.get(field.def_id); + if field_level.is_some() { + self.reach(field.def_id, field_level).ty(); } } } if let Some(ctor_def_id) = struct_def.ctor_def_id() { - let ctor_ev = self.get(ctor_def_id); - if ctor_ev.is_some() { - self.reach(item.owner_id.def_id, ctor_ev).ty(); + let ctor_level = self.get(ctor_def_id); + if ctor_level.is_some() { + self.reach(item.owner_id.def_id, ctor_level).ty(); } } } } + let orig_level = mem::replace(&mut self.prev_level, item_level); intravisit::walk_item(self, item); + self.prev_level = orig_level; } fn visit_block(&mut self, b: &'tcx hir::Block<'tcx>) { // Blocks can have public items, for example impls, but they always // start as completely private regardless of publicity of a function, // constant, type, field, etc., in which this block resides. + let orig_level = mem::replace(&mut self.prev_level, None); intravisit::walk_block(self, b); + self.prev_level = orig_level; } } @@ -941,7 +899,11 @@ impl<'tcx> DefIdVisitor<'tcx> for ReachEverythingInTheInterfaceVisitor<'_, 'tcx> _descr: &dyn fmt::Display, ) -> ControlFlow { if let Some(def_id) = def_id.as_local() { - self.ev.update_eff_vis(def_id, self.effective_vis, None, self.level); + if let (ty::Visibility::Public, _) | (_, Some(Level::ReachableThroughImplTrait)) = + (self.tcx().visibility(def_id.to_def_id()), self.level) + { + self.ev.update(def_id, self.level); + } } ControlFlow::Continue(()) } @@ -2169,6 +2131,7 @@ fn effective_visibilities(tcx: TyCtxt<'_>, (): ()) -> &EffectiveVisibilities { tcx, effective_visibilities: tcx.resolutions(()).effective_visibilities.clone(), macro_reachable: Default::default(), + prev_level: Some(Level::Direct), changed: false, }; diff --git a/compiler/rustc_resolve/src/effective_visibilities.rs b/compiler/rustc_resolve/src/effective_visibilities.rs index 7393bdb388a5..87067189a775 100644 --- a/compiler/rustc_resolve/src/effective_visibilities.rs +++ b/compiler/rustc_resolve/src/effective_visibilities.rs @@ -199,7 +199,7 @@ impl<'r, 'a, 'tcx> EffectiveVisibilitiesVisitor<'r, 'a, 'tcx> { let tcx = self.r.tcx; self.changed |= self.import_effective_visibilities.update( binding, - Some(nominal_vis), + nominal_vis, || cheap_private_vis.unwrap_or_else(|| self.r.private_vis_import(binding)), inherited_eff_vis, parent_id.level(), @@ -213,7 +213,7 @@ impl<'r, 'a, 'tcx> EffectiveVisibilitiesVisitor<'r, 'a, 'tcx> { let tcx = self.r.tcx; self.changed |= self.def_effective_visibilities.update( def_id, - Some(nominal_vis), + nominal_vis, || cheap_private_vis.unwrap_or_else(|| self.r.private_vis_def(def_id)), inherited_eff_vis, parent_id.level(), diff --git a/library/core/src/iter/adapters/flatten.rs b/library/core/src/iter/adapters/flatten.rs index 2568aaf34f3f..520ec9abcf0d 100644 --- a/library/core/src/iter/adapters/flatten.rs +++ b/library/core/src/iter/adapters/flatten.rs @@ -310,7 +310,6 @@ where /// Real logic of both `Flatten` and `FlatMap` which simply delegate to /// this type. #[derive(Clone, Debug)] -#[unstable(feature = "trusted_len", issue = "37572")] struct FlattenCompat { iter: Fuse, frontiter: Option, @@ -464,7 +463,6 @@ where } } -#[unstable(feature = "trusted_len", issue = "37572")] impl Iterator for FlattenCompat where I: Iterator>, @@ -579,7 +577,6 @@ where } } -#[unstable(feature = "trusted_len", issue = "37572")] impl DoubleEndedIterator for FlattenCompat where I: DoubleEndedIterator>, @@ -649,7 +646,6 @@ where } } -#[unstable(feature = "trusted_len", issue = "37572")] unsafe impl TrustedLen for FlattenCompat::IntoIter> where @@ -657,7 +653,6 @@ where { } -#[unstable(feature = "trusted_len", issue = "37572")] unsafe impl<'a, const N: usize, I, T> TrustedLen for FlattenCompat::IntoIter> where @@ -665,7 +660,6 @@ where { } -#[unstable(feature = "trusted_len", issue = "37572")] unsafe impl<'a, const N: usize, I, T> TrustedLen for FlattenCompat::IntoIter> where From 4d219d066626c49fdec3d8fa143a94c81150b633 Mon Sep 17 00:00:00 2001 From: yukang Date: Tue, 9 May 2023 11:51:04 +0800 Subject: [PATCH 85/97] move sugg to derive session diagnostic --- compiler/rustc_parse/messages.ftl | 1 + compiler/rustc_parse/src/errors.rs | 12 ++++++++++++ compiler/rustc_parse/src/parser/diagnostics.rs | 14 +++++--------- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/compiler/rustc_parse/messages.ftl b/compiler/rustc_parse/messages.ftl index cd296dca133f..a01e6f5ba113 100644 --- a/compiler/rustc_parse/messages.ftl +++ b/compiler/rustc_parse/messages.ftl @@ -339,6 +339,7 @@ parse_expected_identifier = expected identifier parse_sugg_escape_identifier = escape `{$ident_name}` to use it as an identifier parse_sugg_remove_comma = remove this comma +parse_sugg_add_let_for_stmt = you might have meant to introduce a new binding parse_expected_semi_found_reserved_identifier_str = expected `;`, found reserved identifier `{$token}` parse_expected_semi_found_keyword_str = expected `;`, found keyword `{$token}` diff --git a/compiler/rustc_parse/src/errors.rs b/compiler/rustc_parse/src/errors.rs index 010a13aefa42..4dffdae1dc9b 100644 --- a/compiler/rustc_parse/src/errors.rs +++ b/compiler/rustc_parse/src/errors.rs @@ -906,6 +906,18 @@ pub(crate) struct SuggRemoveComma { pub span: Span, } +#[derive(Subdiagnostic)] +#[suggestion( + parse_sugg_add_let_for_stmt, + style = "verbose", + applicability = "maybe-incorrect", + code = "let " +)] +pub(crate) struct SuggAddMissingLetStmt { + #[primary_span] + pub span: Span, +} + #[derive(Subdiagnostic)] pub(crate) enum ExpectedIdentifierFound { #[label(parse_expected_identifier_found_reserved_identifier)] diff --git a/compiler/rustc_parse/src/parser/diagnostics.rs b/compiler/rustc_parse/src/parser/diagnostics.rs index b0822fe79565..3002f23da75c 100644 --- a/compiler/rustc_parse/src/parser/diagnostics.rs +++ b/compiler/rustc_parse/src/parser/diagnostics.rs @@ -13,7 +13,7 @@ use crate::errors::{ IncorrectUseOfAwait, ParenthesesInForHead, ParenthesesInForHeadSugg, PatternMethodParamWithoutBody, QuestionMarkInType, QuestionMarkInTypeSugg, SelfParamNotFirst, StructLiteralBodyWithoutPath, StructLiteralBodyWithoutPathSugg, StructLiteralNeedingParens, - StructLiteralNeedingParensSugg, SuggEscapeIdentifier, SuggRemoveComma, + StructLiteralNeedingParensSugg, SuggAddMissingLetStmt, SuggEscapeIdentifier, SuggRemoveComma, UnexpectedConstInGenericParam, UnexpectedConstParamDeclaration, UnexpectedConstParamDeclarationSugg, UnmatchedAngleBrackets, UseEqInstead, }; @@ -32,8 +32,8 @@ use rustc_ast::{ use rustc_ast_pretty::pprust; use rustc_data_structures::fx::FxHashSet; use rustc_errors::{ - pluralize, Applicability, Diagnostic, DiagnosticBuilder, DiagnosticMessage, ErrorGuaranteed, - FatalError, Handler, IntoDiagnostic, MultiSpan, PResult, + pluralize, AddToDiagnostic, Applicability, Diagnostic, DiagnosticBuilder, DiagnosticMessage, + ErrorGuaranteed, FatalError, Handler, IntoDiagnostic, MultiSpan, PResult, }; use rustc_session::errors::ExprParenthesesNeeded; use rustc_span::source_map::Spanned; @@ -1019,12 +1019,8 @@ impl<'a> Parser<'a> { match self.parse_ty() { Ok(_) => { if self.token == token::Eq { - err.span_suggestion_verbose( - prev_span, - "you might have meant to introduce a new binding", - "let ".to_string(), - Applicability::MaybeIncorrect, - ); + let sugg = SuggAddMissingLetStmt { span: prev_span }; + sugg.add_to_diagnostic(err); } } Err(e) => { From d5843ddaf1f3291e30b60af44b58dccbcd9b6090 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Mon, 24 Apr 2023 17:31:32 +0200 Subject: [PATCH 86/97] Limit lifetime of format_args!() with inlined args. --- compiler/rustc_ast_lowering/src/format.rs | 25 ++++++++++++++++++++++- compiler/rustc_span/src/symbol.rs | 1 + library/core/src/fmt/rt.rs | 15 ++++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/compiler/rustc_ast_lowering/src/format.rs b/compiler/rustc_ast_lowering/src/format.rs index 9b295339d945..afcf8b15cd80 100644 --- a/compiler/rustc_ast_lowering/src/format.rs +++ b/compiler/rustc_ast_lowering/src/format.rs @@ -446,7 +446,30 @@ fn expand_format_args<'hir>( && argmap.iter().enumerate().all(|(i, (&(j, _), _))| i == j) && arguments.iter().skip(1).all(|arg| !may_contain_yield_point(&arg.expr)); - let args = if use_simple_array { + let args = if arguments.is_empty() { + // Generate: + // &::none() + // + // Note: + // `none()` just returns `[]`. We use `none()` rather than `[]` to limit the lifetime. + // + // This makes sure that this still fails to compile, even when the argument is inlined: + // + // ``` + // let f = format_args!("{}", "a"); + // println!("{f}"); // error E0716 + // ``` + // + // Cases where keeping the object around is allowed, such as `format_args!("a")`, + // are handled above by the `allow_const` case. + let none_fn = ctx.arena.alloc(ctx.expr_lang_item_type_relative( + macsp, + hir::LangItem::FormatArgument, + sym::none, + )); + let none = ctx.expr_call(macsp, none_fn, &[]); + ctx.expr(macsp, hir::ExprKind::AddrOf(hir::BorrowKind::Ref, hir::Mutability::Not, none)) + } else if use_simple_array { // Generate: // &[ // ::new_display(&arg0), diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index 117e2774bd87..60efcb768cb0 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1033,6 +1033,7 @@ symbols! { non_exhaustive_omitted_patterns_lint, non_lifetime_binders, non_modrs_mods, + none, nontemporal_store, noop_method_borrow, noop_method_clone, diff --git a/library/core/src/fmt/rt.rs b/library/core/src/fmt/rt.rs index 0596f6c30ce6..d37888c27bde 100644 --- a/library/core/src/fmt/rt.rs +++ b/library/core/src/fmt/rt.rs @@ -152,6 +152,21 @@ impl<'a> Argument<'a> { None } } + + /// Used by `format_args` when all arguments are gone after inlining, + /// when using `&[]` would incorrectly allow for a bigger lifetime. + /// + /// This fails without format argument inlining, and that shouldn't be different + /// when the argument is inlined: + /// + /// ```compile_fail,E0716 + /// let f = format_args!("{}", "a"); + /// println!("{f}"); + /// ``` + #[inline(always)] + pub fn none() -> [Self; 0] { + [] + } } /// This struct represents the unsafety of constructing an `Arguments`. From 34903755701a5595ee4bab3bb89de15c5469cd3e Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 4 Dec 2022 18:26:09 +0000 Subject: [PATCH 87/97] Implement SSA-based reference propagation. --- compiler/rustc_middle/src/mir/mod.rs | 13 + compiler/rustc_mir_dataflow/src/impls/mod.rs | 2 +- .../src/impls/storage_liveness.rs | 66 +++ compiler/rustc_mir_transform/src/copy_prop.rs | 2 +- compiler/rustc_mir_transform/src/lib.rs | 2 + .../src/normalize_array_len.rs | 2 +- compiler/rustc_mir_transform/src/ref_prop.rs | 324 +++++++++++++ compiler/rustc_mir_transform/src/ssa.rs | 130 ++++-- ...dominate_storage.ReferencePropagation.diff | 38 ++ ..._prop.maybe_dead.ReferencePropagation.diff | 50 ++ ...multiple_storage.ReferencePropagation.diff | 27 ++ ...read_through_raw.ReferencePropagation.diff | 24 + ...ence_propagation.ReferencePropagation.diff | 292 ++++++++++++ ...gation_const_ptr.ReferencePropagation.diff | 334 ++++++++++++++ ..._propagation_mut.ReferencePropagation.diff | 288 ++++++++++++ ...pagation_mut_ptr.ReferencePropagation.diff | 294 ++++++++++++ tests/mir-opt/reference_prop.rs | 428 ++++++++++++++++++ tests/mir-opt/slice_filter.rs | 2 + ..._a-{closure#0}.DestinationPropagation.diff | 88 ++-- ...nt_a-{closure#0}.ReferencePropagation.diff | 239 ++++++++++ ...nt_b-{closure#0}.ReferencePropagation.diff | 103 +++++ 21 files changed, 2668 insertions(+), 80 deletions(-) create mode 100644 compiler/rustc_mir_transform/src/ref_prop.rs create mode 100644 tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff create mode 100644 tests/mir-opt/reference_prop.rs create mode 100644 tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff create mode 100644 tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff diff --git a/compiler/rustc_middle/src/mir/mod.rs b/compiler/rustc_middle/src/mir/mod.rs index f2841182a1a3..55991facd89a 100644 --- a/compiler/rustc_middle/src/mir/mod.rs +++ b/compiler/rustc_middle/src/mir/mod.rs @@ -1524,6 +1524,19 @@ impl ProjectionElem { } } + /// Returns `true` if the target of this projection always refers to the same memory region + /// whatever the state of the program. + pub fn is_stable_offset(&self) -> bool { + match self { + Self::Deref | Self::Index(_) => false, + Self::Field(_, _) + | Self::OpaqueCast(_) + | Self::ConstantIndex { .. } + | Self::Subslice { .. } + | Self::Downcast(_, _) => true, + } + } + /// Returns `true` if this is a `Downcast` projection with the given `VariantIdx`. pub fn is_downcast_to(&self, v: VariantIdx) -> bool { matches!(*self, Self::Downcast(_, x) if x == v) diff --git a/compiler/rustc_mir_dataflow/src/impls/mod.rs b/compiler/rustc_mir_dataflow/src/impls/mod.rs index 2a0aff550837..171db6965ac1 100644 --- a/compiler/rustc_mir_dataflow/src/impls/mod.rs +++ b/compiler/rustc_mir_dataflow/src/impls/mod.rs @@ -26,7 +26,7 @@ pub use self::borrowed_locals::borrowed_locals; pub use self::borrowed_locals::MaybeBorrowedLocals; pub use self::liveness::MaybeLiveLocals; pub use self::liveness::MaybeTransitiveLiveLocals; -pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageLive}; +pub use self::storage_liveness::{MaybeRequiresStorage, MaybeStorageDead, MaybeStorageLive}; /// `MaybeInitializedPlaces` tracks all places that might be /// initialized upon reaching a particular point in the control flow diff --git a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs index 4a5d9d520108..9656148581f8 100644 --- a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs +++ b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs @@ -74,6 +74,72 @@ impl<'tcx, 'a> crate::GenKillAnalysis<'tcx> for MaybeStorageLive<'a> { } } +#[derive(Clone)] +pub struct MaybeStorageDead { + always_live_locals: BitSet, +} + +impl MaybeStorageDead { + pub fn new(always_live_locals: BitSet) -> Self { + MaybeStorageDead { always_live_locals } + } +} + +impl<'tcx> crate::AnalysisDomain<'tcx> for MaybeStorageDead { + type Domain = BitSet; + + const NAME: &'static str = "maybe_storage_dead"; + + fn bottom_value(&self, body: &mir::Body<'tcx>) -> Self::Domain { + // bottom = live + BitSet::new_empty(body.local_decls.len()) + } + + fn initialize_start_block(&self, body: &mir::Body<'tcx>, on_entry: &mut Self::Domain) { + assert_eq!(body.local_decls.len(), self.always_live_locals.domain_size()); + for local in body.vars_and_temps_iter() { + if !self.always_live_locals.contains(local) { + on_entry.insert(local); + } + } + } +} + +impl<'tcx> crate::GenKillAnalysis<'tcx> for MaybeStorageDead { + type Idx = Local; + + fn statement_effect( + &self, + trans: &mut impl GenKill, + stmt: &mir::Statement<'tcx>, + _: Location, + ) { + match stmt.kind { + StatementKind::StorageLive(l) => trans.kill(l), + StatementKind::StorageDead(l) => trans.gen(l), + _ => (), + } + } + + fn terminator_effect( + &self, + _trans: &mut impl GenKill, + _: &mir::Terminator<'tcx>, + _: Location, + ) { + // Terminators have no effect + } + + fn call_return_effect( + &self, + _trans: &mut impl GenKill, + _block: BasicBlock, + _return_places: CallReturnPlaces<'_, 'tcx>, + ) { + // Nothing to do when a call returns successfully + } +} + type BorrowedLocalsResults<'a, 'tcx> = ResultsRefCursor<'a, 'a, 'tcx, MaybeBorrowedLocals>; /// Dataflow analysis that determines whether each local requires storage at a diff --git a/compiler/rustc_mir_transform/src/copy_prop.rs b/compiler/rustc_mir_transform/src/copy_prop.rs index 3922ed2fbf7e..2fa5c0bca15b 100644 --- a/compiler/rustc_mir_transform/src/copy_prop.rs +++ b/compiler/rustc_mir_transform/src/copy_prop.rs @@ -76,7 +76,7 @@ fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { fn fully_moved_locals(ssa: &SsaLocals, body: &Body<'_>) -> BitSet { let mut fully_moved = BitSet::new_filled(body.local_decls.len()); - for (_, rvalue) in ssa.assignments(body) { + for (_, rvalue, _) in ssa.assignments(body) { let (Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) | Rvalue::CopyForDeref(place)) = rvalue else { continue }; diff --git a/compiler/rustc_mir_transform/src/lib.rs b/compiler/rustc_mir_transform/src/lib.rs index 5c4b1ead4e9b..277237a5515a 100644 --- a/compiler/rustc_mir_transform/src/lib.rs +++ b/compiler/rustc_mir_transform/src/lib.rs @@ -84,6 +84,7 @@ mod match_branches; mod multiple_return_terminators; mod normalize_array_len; mod nrvo; +mod ref_prop; mod remove_noop_landing_pads; mod remove_storage_markers; mod remove_uninit_drops; @@ -559,6 +560,7 @@ fn run_optimization_passes<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { &separate_const_switch::SeparateConstSwitch, &simplify::SimplifyLocals::BeforeConstProp, ©_prop::CopyProp, + &ref_prop::ReferencePropagation, &const_prop::ConstProp, &dataflow_const_prop::DataflowConstProp, // diff --git a/compiler/rustc_mir_transform/src/normalize_array_len.rs b/compiler/rustc_mir_transform/src/normalize_array_len.rs index b3b831bb4ab0..109a2c0aec6f 100644 --- a/compiler/rustc_mir_transform/src/normalize_array_len.rs +++ b/compiler/rustc_mir_transform/src/normalize_array_len.rs @@ -41,7 +41,7 @@ fn compute_slice_length<'tcx>( ) -> IndexVec>> { let mut slice_lengths = IndexVec::from_elem(None, &body.local_decls); - for (local, rvalue) in ssa.assignments(body) { + for (local, rvalue, _) in ssa.assignments(body) { match rvalue { Rvalue::Cast( CastKind::Pointer(ty::adjustment::PointerCast::Unsize), diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs new file mode 100644 index 000000000000..dfdf4caf8811 --- /dev/null +++ b/compiler/rustc_mir_transform/src/ref_prop.rs @@ -0,0 +1,324 @@ +use rustc_data_structures::fx::FxHashSet; +use rustc_index::bit_set::BitSet; +use rustc_index::IndexVec; +use rustc_middle::mir::visit::*; +use rustc_middle::mir::*; +use rustc_middle::ty::TyCtxt; +use rustc_mir_dataflow::impls::{borrowed_locals, MaybeStorageDead}; +use rustc_mir_dataflow::storage::always_storage_live_locals; +use rustc_mir_dataflow::Analysis; + +use crate::ssa::SsaLocals; +use crate::MirPass; + +/// Propagate references using SSA analysis. +/// +/// MIR building may produce a lot of borrow-dereference patterns. +/// +/// This pass aims to transform the following pattern: +/// _1 = &raw? mut? PLACE; +/// _3 = *_1; +/// _4 = &raw? mut? *_1; +/// +/// Into +/// _1 = &raw? mut? PLACE; +/// _3 = PLACE; +/// _4 = &raw? mut? PLACE; +/// +/// where `PLACE` is a direct or an indirect place expression. +/// +/// There are 3 properties that need to be upheld for this transformation to be legal: +/// - place stability: `PLACE` must refer to the same memory wherever it appears; +/// - pointer liveness: we must not introduce dereferences of dangling pointers; +/// - `&mut` borrow uniqueness. +/// +/// # Stability +/// +/// If `PLACE` is an indirect projection, if its of the form `(*LOCAL).PROJECTIONS` where: +/// - `LOCAL` is SSA; +/// - all projections in `PROJECTIONS` have a stable offset (no dereference and no indexing). +/// +/// If `PLACE` is a direct projection of a local, we consider it as constant if: +/// - the local is always live, or it has a single `StorageLive` that dominates all uses; +/// - all projections have a stable offset. +/// +/// # Liveness +/// +/// When performing a substitution, we must take care not to introduce uses of dangling locals. +/// To ensure this, we walk the body with the `MaybeStorageDead` dataflow analysis: +/// - if we want to replace `*x` by reborrow `*y` and `y` may be dead, we allow replacement and +/// mark storage statements on `y` for removal; +/// - if we want to replace `*x` by non-reborrow `y` and `y` must be live, we allow replacement; +/// - if we want to replace `*x` by non-reborrow `y` and `y` may be dead, we do not replace. +/// +/// # Uniqueness +/// +/// For `&mut` borrows, we also need to preserve the uniqueness property: +/// we must avoid creating a state where we interleave uses of `*_1` and `_2`. +/// To do it, we only perform full substitution of mutable borrows: +/// we replace either all or none of the occurrences of `*_1`. +/// +/// Some care has to be taken when `_1` is copied in other locals. +/// _1 = &raw? mut? _2; +/// _3 = *_1; +/// _4 = _1 +/// _5 = *_4 +/// In such cases, fully substituting `_1` means fully substituting all of the copies. +/// +/// For immutable borrows, we do not need to preserve such uniqueness property, +/// so we perform all the possible substitutions without removing the `_1 = &_2` statement. +pub struct ReferencePropagation; + +impl<'tcx> MirPass<'tcx> for ReferencePropagation { + fn is_enabled(&self, sess: &rustc_session::Session) -> bool { + sess.mir_opt_level() >= 4 + } + + #[instrument(level = "trace", skip(self, tcx, body))] + fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { + debug!(def_id = ?body.source.def_id()); + propagate_ssa(tcx, body); + } +} + +fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { + let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); + let borrowed_locals = borrowed_locals(body); + let ssa = SsaLocals::new(tcx, param_env, body, &borrowed_locals); + + let mut replacer = compute_replacement(tcx, body, &ssa); + debug!(?replacer.targets, ?replacer.allowed_replacements, ?replacer.storage_to_remove); + + replacer.visit_body_preserves_cfg(body); + + if replacer.any_replacement { + crate::simplify::remove_unused_definitions(body); + } +} + +#[derive(Copy, Clone, Debug, PartialEq, Eq)] +enum Value<'tcx> { + /// Not a pointer, or we can't know. + Unknown, + /// We know the value to be a pointer to this place. + /// The boolean indicates whether the reference is mutable, subject the uniqueness rule. + Pointer(Place<'tcx>, bool), +} + +/// For each local, save the place corresponding to `*local`. +#[instrument(level = "trace", skip(tcx, body))] +fn compute_replacement<'tcx>( + tcx: TyCtxt<'tcx>, + body: &Body<'tcx>, + ssa: &SsaLocals, +) -> Replacer<'tcx> { + // Compute `MaybeStorageDead` dataflow to check that we only replace when the pointee is + // definitely live. + let always_live_locals = always_storage_live_locals(body); + let mut maybe_dead = MaybeStorageDead::new(always_live_locals) + .into_engine(tcx, body) + .iterate_to_fixpoint() + .into_results_cursor(body); + + // Map for each local to the pointee. + let mut targets = IndexVec::from_elem(Value::Unknown, &body.local_decls); + // Set of locals for which we will remove their storage statement. This is useful for + // reborrowed references. + let mut storage_to_remove = BitSet::new_empty(body.local_decls.len()); + + let fully_replacable_locals = fully_replacable_locals(ssa); + + let mut can_perform_opt = |target: Place<'tcx>, loc: Location| { + maybe_dead.seek_after_primary_effect(loc); + let maybe_dead = maybe_dead.contains(target.local); + + if target.projection.first() == Some(&PlaceElem::Deref) { + // We are creating a reborrow. As `place.local` is a reference, removing the + // `StorageDead` is fine. + if maybe_dead { + storage_to_remove.insert(target.local); + } + true + } else { + // This is a proper dereference. We can only allow it if `target` is live. + !maybe_dead + } + }; + + for (local, rvalue, location) in ssa.assignments(body) { + debug!(?local); + + // Only visit if we have something to do. + let Value::Unknown = targets[local] else { bug!() }; + + let ty = body.local_decls[local].ty; + + // If this is not a reference or pointer, do nothing. + if !ty.is_any_ptr() { + debug!("not a reference or pointer"); + continue; + } + + // If this a mutable reference that we cannot fully replace, mark it as unknown. + if ty.is_mutable_ptr() && !fully_replacable_locals.contains(local) { + debug!("not fully replaceable"); + continue; + } + + debug!(?rvalue); + match rvalue { + // This is a copy, just use the value we have in store for the previous one. + // As we are visiting in `assignment_order`, ie. reverse postorder, `rhs` should + // have been visited before. + Rvalue::Use(Operand::Copy(place) | Operand::Move(place)) + | Rvalue::CopyForDeref(place) => { + if let Some(rhs) = place.as_local() { + let target = targets[rhs]; + if matches!(target, Value::Pointer(..)) { + targets[local] = target; + } else if ssa.is_ssa(rhs) { + let refmut = body.local_decls[rhs].ty.is_mutable_ptr(); + targets[local] = Value::Pointer(tcx.mk_place_deref(rhs.into()), refmut); + } + } + } + Rvalue::Ref(_, _, place) | Rvalue::AddressOf(_, place) => { + let mut place = *place; + // Try to see through `place` in order to collapse reborrow chains. + if place.projection.first() == Some(&PlaceElem::Deref) + && let Value::Pointer(target, refmut) = targets[place.local] + // Only see through immutable reference and pointers, as we do not know yet if + // mutable references are fully replaced. + && !refmut + // Only collapse chain if the pointee is definitely live. + && can_perform_opt(target, location) + { + place = target.project_deeper(&place.projection[1..], tcx); + } + assert_ne!(place.local, local); + if ssa.is_constant_place(place) { + targets[local] = Value::Pointer(place, ty.is_mutable_ptr()); + } + } + // We do not know what to do, so keep as not-a-pointer. + _ => {} + } + } + + debug!(?targets); + + let mut finder = ReplacementFinder { + targets: &mut targets, + can_perform_opt, + allowed_replacements: FxHashSet::default(), + }; + let reachable_blocks = traversal::reachable_as_bitset(body); + for (bb, bbdata) in body.basic_blocks.iter_enumerated() { + // Only visit reachable blocks as we rely on dataflow. + if reachable_blocks.contains(bb) { + finder.visit_basic_block_data(bb, bbdata); + } + } + + let allowed_replacements = finder.allowed_replacements; + return Replacer { + tcx, + targets, + storage_to_remove, + allowed_replacements, + any_replacement: false, + }; + + struct ReplacementFinder<'a, 'tcx, F> { + targets: &'a mut IndexVec>, + can_perform_opt: F, + allowed_replacements: FxHashSet<(Local, Location)>, + } + + impl<'tcx, F> Visitor<'tcx> for ReplacementFinder<'_, 'tcx, F> + where + F: FnMut(Place<'tcx>, Location) -> bool, + { + fn visit_place(&mut self, place: &Place<'tcx>, ctxt: PlaceContext, loc: Location) { + if matches!(ctxt, PlaceContext::NonUse(_)) { + // There is no need to check liveness for non-uses. + return; + } + + if let Value::Pointer(target, refmut) = self.targets[place.local] + && place.projection.first() == Some(&PlaceElem::Deref) + { + let perform_opt = (self.can_perform_opt)(target, loc); + if perform_opt { + self.allowed_replacements.insert((target.local, loc)); + } else if refmut { + // This mutable reference is not fully replacable, so drop it. + self.targets[place.local] = Value::Unknown; + } + } + } + } +} + +/// Compute the set of locals that can be fully replaced. +/// +/// We consider a local to be replacable iff it's only used in a `Deref` projection `*_local` or +/// non-use position (like storage statements and debuginfo). +fn fully_replacable_locals(ssa: &SsaLocals) -> BitSet { + let mut replacable = BitSet::new_empty(ssa.num_locals()); + + // First pass: for each local, whether its uses can be fully replaced. + for local in ssa.locals() { + if ssa.num_direct_uses(local) == 0 { + replacable.insert(local); + } + } + + // Second pass: a local can only be fully replaced if all its copies can. + ssa.meet_copy_equivalence(&mut replacable); + + replacable +} + +/// Utility to help performing subtitution of `*pattern` by `target`. +struct Replacer<'tcx> { + tcx: TyCtxt<'tcx>, + targets: IndexVec>, + storage_to_remove: BitSet, + allowed_replacements: FxHashSet<(Local, Location)>, + any_replacement: bool, +} + +impl<'tcx> MutVisitor<'tcx> for Replacer<'tcx> { + fn tcx(&self) -> TyCtxt<'tcx> { + self.tcx + } + + fn visit_place(&mut self, place: &mut Place<'tcx>, ctxt: PlaceContext, loc: Location) { + if let Value::Pointer(target, _) = self.targets[place.local] + && place.projection.first() == Some(&PlaceElem::Deref) + { + let perform_opt = matches!(ctxt, PlaceContext::NonUse(_)) + || self.allowed_replacements.contains(&(target.local, loc)); + + if perform_opt { + *place = target.project_deeper(&place.projection[1..], self.tcx); + self.any_replacement = true; + } + } else { + self.super_place(place, ctxt, loc); + } + } + + fn visit_statement(&mut self, stmt: &mut Statement<'tcx>, loc: Location) { + match stmt.kind { + StatementKind::StorageLive(l) | StatementKind::StorageDead(l) + if self.storage_to_remove.contains(l) => + { + stmt.make_nop(); + } + // Do not remove assignments as they may still be useful for debuginfo. + _ => self.super_statement(stmt, loc), + } + } +} diff --git a/compiler/rustc_mir_transform/src/ssa.rs b/compiler/rustc_mir_transform/src/ssa.rs index ec8d42c16527..270bb540b80d 100644 --- a/compiler/rustc_mir_transform/src/ssa.rs +++ b/compiler/rustc_mir_transform/src/ssa.rs @@ -6,6 +6,7 @@ use rustc_middle::middle::resolve_bound_vars::Set1; use rustc_middle::mir::visit::*; use rustc_middle::mir::*; use rustc_middle::ty::{ParamEnv, TyCtxt}; +use rustc_mir_dataflow::storage::always_storage_live_locals; #[derive(Debug)] pub struct SsaLocals { @@ -17,6 +18,12 @@ pub struct SsaLocals { assignment_order: Vec, /// Copy equivalence classes between locals. See `copy_classes` for documentation. copy_classes: IndexVec, + /// Number of "direct" uses of each local, ie. uses that are not dereferences. + /// We ignore non-uses (Storage statements, debuginfo). + direct_uses: IndexVec, + /// Set of "StorageLive" statements for each local. When the "StorageLive" statement does not + /// dominate all uses of the local, we mark it as `Set1::Many`. + storage_live: IndexVec>, } /// We often encounter MIR bodies with 1 or 2 basic blocks. In those cases, it's unnecessary to @@ -26,23 +33,31 @@ struct SmallDominators { inner: Option>, } -trait DomExt { - fn dominates(self, _other: Self, dominators: &SmallDominators) -> bool; -} - -impl DomExt for Location { - fn dominates(self, other: Location, dominators: &SmallDominators) -> bool { - if self.block == other.block { - self.statement_index <= other.statement_index +impl SmallDominators { + fn dominates(&self, first: Location, second: Location) -> bool { + if first.block == second.block { + first.statement_index <= second.statement_index + } else if let Some(inner) = &self.inner { + inner.dominates(first.block, second.block) } else { - dominators.dominates(self.block, other.block) + first.block < second.block } } -} -impl SmallDominators { - fn dominates(&self, dom: BasicBlock, node: BasicBlock) -> bool { - if let Some(inner) = &self.inner { inner.dominates(dom, node) } else { dom < node } + fn check_dominates(&mut self, set: &mut Set1, loc: Location) { + let assign_dominates = match *set { + Set1::Empty | Set1::Many => false, + Set1::One(LocationExtended::Arg) => true, + Set1::One(LocationExtended::Plain(assign)) => { + self.dominates(assign.successor_within_block(), loc) + } + }; + // We are visiting a use that is not dominated by an assignment. + // Either there is a cycle involved, or we are reading for uninitialized local. + // Bail out. + if !assign_dominates { + *set = Set1::Many; + } } } @@ -59,7 +74,11 @@ impl SsaLocals { let dominators = if body.basic_blocks.len() > 2 { Some(body.basic_blocks.dominators()) } else { None }; let dominators = SmallDominators { inner: dominators }; - let mut visitor = SsaVisitor { assignments, assignment_order, dominators }; + + let direct_uses = IndexVec::from_elem(0, &body.local_decls); + let storage_live = IndexVec::from_elem(Set1::Empty, &body.local_decls); + let mut visitor = + SsaVisitor { assignments, assignment_order, dominators, direct_uses, storage_live }; for (local, decl) in body.local_decls.iter_enumerated() { if matches!(body.local_kind(local), LocalKind::Arg) { @@ -70,6 +89,10 @@ impl SsaLocals { } } + for local in always_storage_live_locals(body).iter() { + visitor.storage_live[local] = Set1::One(LocationExtended::Arg); + } + if body.basic_blocks.len() > 2 { for (bb, data) in traversal::reverse_postorder(body) { visitor.visit_basic_block_data(bb, data); @@ -85,36 +108,66 @@ impl SsaLocals { } debug!(?visitor.assignments); + debug!(?visitor.direct_uses); + debug!(?visitor.storage_live); visitor .assignment_order .retain(|&local| matches!(visitor.assignments[local], Set1::One(_))); debug!(?visitor.assignment_order); - let copy_classes = compute_copy_classes(&visitor, body); + let copy_classes = compute_copy_classes(&mut visitor, body); SsaLocals { assignments: visitor.assignments, assignment_order: visitor.assignment_order, + direct_uses: visitor.direct_uses, + storage_live: visitor.storage_live, copy_classes, } } + pub fn num_locals(&self) -> usize { + self.assignments.len() + } + + pub fn locals(&self) -> impl Iterator { + self.assignments.indices() + } + pub fn is_ssa(&self, local: Local) -> bool { matches!(self.assignments[local], Set1::One(_)) } + /// Returns true iff we can use `p` as a pointee. + pub fn is_constant_place(&self, p: Place<'_>) -> bool { + // We only allow `Deref` as the first projection, to avoid surprises. + if p.projection.first() == Some(&PlaceElem::Deref) { + // `p == (*some_local).xxx`, it is constant only if `some_local` is constant. + // We approximate constness using SSAness. + self.is_ssa(p.local) && p.projection[1..].iter().all(PlaceElem::is_stable_offset) + } else { + matches!(self.storage_live[p.local], Set1::One(_)) + && p.projection[..].iter().all(PlaceElem::is_stable_offset) + } + } + + /// Return the number of uses if a local that are not "Deref". + pub fn num_direct_uses(&self, local: Local) -> u32 { + self.direct_uses[local] + } + pub fn assignments<'a, 'tcx>( &'a self, body: &'a Body<'tcx>, - ) -> impl Iterator)> + 'a { + ) -> impl Iterator, Location)> + 'a { self.assignment_order.iter().filter_map(|&local| { if let Set1::One(LocationExtended::Plain(loc)) = self.assignments[local] { // `loc` must point to a direct assignment to `local`. let Either::Left(stmt) = body.stmt_at(loc) else { bug!() }; let Some((target, rvalue)) = stmt.kind.as_assign() else { bug!() }; assert_eq!(target.as_local(), Some(local)); - Some((local, rvalue)) + Some((local, rvalue, loc)) } else { None } @@ -177,25 +230,8 @@ struct SsaVisitor { dominators: SmallDominators, assignments: IndexVec>, assignment_order: Vec, -} - -impl SsaVisitor { - fn check_assignment_dominates(&mut self, local: Local, loc: Location) { - let set = &mut self.assignments[local]; - let assign_dominates = match *set { - Set1::Empty | Set1::Many => false, - Set1::One(LocationExtended::Arg) => true, - Set1::One(LocationExtended::Plain(assign)) => { - assign.successor_within_block().dominates(loc, &self.dominators) - } - }; - // We are visiting a use that is not dominated by an assignment. - // Either there is a cycle involved, or we are reading for uninitialized local. - // Bail out. - if !assign_dominates { - *set = Set1::Many; - } - } + direct_uses: IndexVec, + storage_live: IndexVec>, } impl<'tcx> Visitor<'tcx> for SsaVisitor { @@ -207,14 +243,23 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { // Only record if SSA-like, to avoid growing the vector needlessly. self.assignment_order.push(local); } + self.dominators.check_dominates(&mut self.storage_live[local], loc); } // Anything can happen with raw pointers, so remove them. PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf) - | PlaceContext::MutatingUse(_) => self.assignments[local] = Set1::Many, + | PlaceContext::MutatingUse(_) => { + self.assignments[local] = Set1::Many; + self.dominators.check_dominates(&mut self.storage_live[local], loc); + } // Immutable borrows are taken into account in `SsaLocals::new` by // removing non-freeze locals. PlaceContext::NonMutatingUse(_) => { - self.check_assignment_dominates(local, loc); + self.dominators.check_dominates(&mut self.assignments[local], loc); + self.dominators.check_dominates(&mut self.storage_live[local], loc); + self.direct_uses[local] += 1; + } + PlaceContext::NonUse(NonUseContext::StorageLive) => { + self.storage_live[local].insert(LocationExtended::Plain(loc)); } PlaceContext::NonUse(_) => {} } @@ -224,11 +269,12 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { if place.projection.first() == Some(&PlaceElem::Deref) { // Do not do anything for storage statements and debuginfo. if ctxt.is_use() { - // A use through a `deref` only reads from the local, and cannot write to it. + // Only change the context if it is a real use, not a "use" in debuginfo. let new_ctxt = PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection); self.visit_projection(place.as_ref(), new_ctxt, loc); - self.check_assignment_dominates(place.local, loc); + self.dominators.check_dominates(&mut self.assignments[place.local], loc); + self.dominators.check_dominates(&mut self.storage_live[place.local], loc); } return; } @@ -237,7 +283,7 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { } #[instrument(level = "trace", skip(ssa, body))] -fn compute_copy_classes(ssa: &SsaVisitor, body: &Body<'_>) -> IndexVec { +fn compute_copy_classes(ssa: &mut SsaVisitor, body: &Body<'_>) -> IndexVec { let mut copies = IndexVec::from_fn_n(|l| l, body.local_decls.len()); for &local in &ssa.assignment_order { @@ -267,9 +313,11 @@ fn compute_copy_classes(ssa: &SsaVisitor, body: &Body<'_>) -> IndexVec () { + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:23: +0:23 + let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _5: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _6: bool; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + goto -> bb1; // scope 0 at $DIR/reference_prop.rs:+8:11: +8:20 + } + + bb1: { + _1 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18 + _2 = &_1; // scope 0 at $DIR/reference_prop.rs:+11:13: +11:19 + goto -> bb2; // scope 0 at $DIR/reference_prop.rs:+12:13: +12:22 + } + + bb2: { + _5 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_5) -> bb3; // scope 0 at $DIR/reference_prop.rs:+16:13: +16:38 + // mir::Constant + // + span: $DIR/reference_prop.rs:357:28: 357:34 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb3: { + StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+19:13: +19:27 + StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:27 + _6 = const true; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + switchInt(_6) -> [0: bb3, otherwise: bb1]; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:47 + } + } + diff --git a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff new file mode 100644 index 000000000000..9dac0b333b81 --- /dev/null +++ b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff @@ -0,0 +1,50 @@ +- // MIR for `maybe_dead` before ReferencePropagation ++ // MIR for `maybe_dead` after ReferencePropagation + + fn maybe_dead(_1: bool) -> () { + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:24: +0:24 + let mut _2: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _5: &mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _6: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _7: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+7:13: +7:27 + StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+8:13: +8:27 + _2 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+9:13: +9:18 + _3 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18 + _4 = &_2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _5 = &mut _3; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + (*_5) = const 7_i32; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:19 + switchInt(_1) -> [1: bb1, otherwise: bb2]; // scope 0 at $DIR/reference_prop.rs:+15:13: +15:46 + } + + bb1: { + StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+18:13: +18:27 + StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+19:13: +19:27 + goto -> bb2; // scope 0 at $DIR/reference_prop.rs:+20:13: +20:22 + } + + bb2: { + _6 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_6) -> bb3; // scope 0 at $DIR/reference_prop.rs:+25:13: +25:38 + // mir::Constant + // + span: $DIR/reference_prop.rs:394:28: 394:34 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb3: { + _7 = (*_5); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_7) -> bb4; // scope 0 at $DIR/reference_prop.rs:+31:13: +31:43 + // mir::Constant + // + span: $DIR/reference_prop.rs:400:33: 400:39 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb4: { + return; // scope 0 at $DIR/reference_prop.rs:+34:13: +34:21 + } + } + diff --git a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff new file mode 100644 index 000000000000..994791072e11 --- /dev/null +++ b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff @@ -0,0 +1,27 @@ +- // MIR for `multiple_storage` before ReferencePropagation ++ // MIR for `multiple_storage` after ReferencePropagation + + fn multiple_storage() -> () { + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:23: +0:23 + let mut _1: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _2: &i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+6:13: +6:27 + _1 = const 5_i32; // scope 0 at $DIR/reference_prop.rs:+7:13: +7:18 + _2 = &_1; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + StorageDead(_1); // scope 0 at $DIR/reference_prop.rs:+9:13: +9:27 + StorageLive(_1); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:27 + _3 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_3) -> bb1; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:43 + // mir::Constant + // + span: $DIR/reference_prop.rs:331:33: 331:39 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } + } + + bb1: { + return; // scope 0 at $DIR/reference_prop.rs:+18:13: +18:21 + } + } + diff --git a/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff new file mode 100644 index 000000000000..a7d505c69066 --- /dev/null +++ b/tests/mir-opt/reference_prop.read_through_raw.ReferencePropagation.diff @@ -0,0 +1,24 @@ +- // MIR for `read_through_raw` before ReferencePropagation ++ // MIR for `read_through_raw` after ReferencePropagation + + fn read_through_raw(_1: &mut usize) -> usize { + let mut _0: usize; // return place in scope 0 at $DIR/reference_prop.rs:+0:39: +0:44 + let mut _2: &mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _3: &mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _4: *mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _5: *mut usize; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + + bb0: { + _2 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:25 +- _3 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:26 +- _4 = &raw mut (*_2); // scope 0 at $DIR/reference_prop.rs:+12:13: +12:30 +- _5 = &raw mut (*_3); // scope 0 at $DIR/reference_prop.rs:+13:13: +13:30 +- _0 = (*_4); // scope 0 at $DIR/reference_prop.rs:+15:13: +15:22 +- _0 = (*_5); // scope 0 at $DIR/reference_prop.rs:+16:13: +16:22 ++ _3 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:26 ++ _0 = (*_2); // scope 0 at $DIR/reference_prop.rs:+15:13: +15:22 ++ _0 = (*_3); // scope 0 at $DIR/reference_prop.rs:+16:13: +16:22 + return; // scope 0 at $DIR/reference_prop.rs:+17:13: +17:21 + } + } + diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff new file mode 100644 index 000000000000..12aea890e638 --- /dev/null +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -0,0 +1,292 @@ +- // MIR for `reference_propagation` before ReferencePropagation ++ // MIR for `reference_propagation` after ReferencePropagation + + fn reference_propagation(_1: &T, _2: &T) -> () { + debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:39: +0:45 + debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:54: +0:66 + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:75: +0:75 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + let _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:14 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + let _8: usize; // in scope 0 at $DIR/reference_prop.rs:+10:13: +10:14 + let mut _11: &usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:16 + let _12: &usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:16 + let _14: (); // in scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + let _15: usize; // in scope 0 at $DIR/reference_prop.rs:+20:13: +20:14 + let _19: (); // in scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + let _20: usize; // in scope 0 at $DIR/reference_prop.rs:+28:13: +28:14 + let _24: (); // in scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + let _25: usize; // in scope 0 at $DIR/reference_prop.rs:+36:13: +36:14 + let _28: (); // in scope 0 at $DIR/reference_prop.rs:+39:9: +39:18 + let mut _29: &usize; // in scope 0 at $DIR/reference_prop.rs:+39:16: +39:17 + let _30: (); // in scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + let _31: usize; // in scope 0 at $DIR/reference_prop.rs:+44:13: +44:14 + let _37: (); // in scope 0 at $DIR/reference_prop.rs:+52:9: +52:19 + let mut _38: &usize; // in scope 0 at $DIR/reference_prop.rs:+52:16: +52:18 + let _39: (); // in scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 + let _40: &T; // in scope 0 at $DIR/reference_prop.rs:+57:13: +57:14 + let _42: &T; // in scope 0 at $DIR/reference_prop.rs:+63:13: +63:14 + let mut _43: &T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:28 + let _44: &T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:28 + scope 1 { + debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 + let _5: &usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 + scope 2 { + debug b => _5; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + let _6: usize; // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 + scope 3 { + debug c => _6; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 + } + } + } + scope 4 { + debug a => _8; // in scope 4 at $DIR/reference_prop.rs:+10:13: +10:14 + let _9: usize; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:15 + scope 5 { + debug a2 => _9; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:15 + let mut _10: &usize; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:18 + scope 6 { + debug b => _10; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:18 + let _13: usize; // in scope 6 at $DIR/reference_prop.rs:+15:13: +15:14 + scope 7 { + debug c => _13; // in scope 7 at $DIR/reference_prop.rs:+15:13: +15:14 + } + } + } + } + scope 8 { + debug a => _15; // in scope 8 at $DIR/reference_prop.rs:+20:13: +20:14 + let _16: &usize; // in scope 8 at $DIR/reference_prop.rs:+21:13: +21:14 + scope 9 { + debug b => _16; // in scope 9 at $DIR/reference_prop.rs:+21:13: +21:14 + let _17: &&usize; // in scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 + scope 10 { + debug d => _17; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:14 + let _18: usize; // in scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 + scope 11 { + debug c => _18; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + } + } + } + } + scope 12 { + debug a => _20; // in scope 12 at $DIR/reference_prop.rs:+28:13: +28:14 + let mut _21: &usize; // in scope 12 at $DIR/reference_prop.rs:+29:13: +29:18 + scope 13 { + debug b => _21; // in scope 13 at $DIR/reference_prop.rs:+29:13: +29:18 + let _22: &mut &usize; // in scope 13 at $DIR/reference_prop.rs:+30:13: +30:14 + scope 14 { + debug d => _22; // in scope 14 at $DIR/reference_prop.rs:+30:13: +30:14 + let _23: usize; // in scope 14 at $DIR/reference_prop.rs:+31:13: +31:14 + scope 15 { + debug c => _23; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:14 + } + } + } + } + scope 16 { + debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+36:13: +36:14 + let _26: &usize; // in scope 16 at $DIR/reference_prop.rs:+37:13: +37:14 + scope 17 { + debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+37:13: +37:14 + let _27: usize; // in scope 17 at $DIR/reference_prop.rs:+38:13: +38:14 + scope 18 { + debug c => _27; // in scope 18 at $DIR/reference_prop.rs:+38:13: +38:14 + } + } + } + scope 19 { + debug a => _31; // in scope 19 at $DIR/reference_prop.rs:+44:13: +44:14 + let _32: &usize; // in scope 19 at $DIR/reference_prop.rs:+45:13: +45:15 + scope 20 { + debug b1 => _32; // in scope 20 at $DIR/reference_prop.rs:+45:13: +45:15 + let _33: usize; // in scope 20 at $DIR/reference_prop.rs:+46:13: +46:14 + scope 21 { + debug c => _33; // in scope 21 at $DIR/reference_prop.rs:+46:13: +46:14 + let _34: &usize; // in scope 21 at $DIR/reference_prop.rs:+47:13: +47:15 + scope 22 { + debug b2 => _34; // in scope 22 at $DIR/reference_prop.rs:+47:13: +47:15 + let _35: usize; // in scope 22 at $DIR/reference_prop.rs:+48:13: +48:15 + scope 23 { + debug c2 => _35; // in scope 23 at $DIR/reference_prop.rs:+48:13: +48:15 + let _36: &usize; // in scope 23 at $DIR/reference_prop.rs:+49:13: +49:15 + scope 24 { + debug b3 => _36; // in scope 24 at $DIR/reference_prop.rs:+49:13: +49:15 + } + } + } + } + } + } + scope 25 { + debug a => _40; // in scope 25 at $DIR/reference_prop.rs:+57:13: +57:14 + let _41: T; // in scope 25 at $DIR/reference_prop.rs:+58:13: +58:14 + scope 26 { + debug b => _41; // in scope 26 at $DIR/reference_prop.rs:+58:13: +58:14 + } + } + scope 27 { + debug a => _42; // in scope 27 at $DIR/reference_prop.rs:+63:13: +63:14 + let _45: T; // in scope 27 at $DIR/reference_prop.rs:+65:13: +65:14 + scope 28 { + debug b => _45; // in scope 28 at $DIR/reference_prop.rs:+65:13: +65:14 + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:14 + _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:17: +3:24 + StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 + _5 = &_4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:19 + StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 +- _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 +- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 ++ _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 + StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+6:5: +6:6 + StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+6:5: +6:6 + StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 +- StorageLive(_7); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + StorageLive(_8); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:14 + _8 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+10:17: +10:24 + StorageLive(_9); // scope 4 at $DIR/reference_prop.rs:+11:13: +11:15 + _9 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+11:18: +11:25 + StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+12:13: +12:18 + _10 = &_8; // scope 5 at $DIR/reference_prop.rs:+12:21: +12:23 + StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 +- StorageLive(_12); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 +- _12 = &_9; // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 +- _11 = &(*_12); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 ++ _11 = &_9; // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 + _10 = move _11; // scope 6 at $DIR/reference_prop.rs:+13:9: +13:16 + StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+13:15: +13:16 +- StorageDead(_12); // scope 6 at $DIR/reference_prop.rs:+13:16: +13:17 + StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+15:13: +15:14 + _13 = (*_10); // scope 6 at $DIR/reference_prop.rs:+15:17: +15:19 +- _7 = const (); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_9); // scope 4 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_8); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 +- StorageDead(_7); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 +- StorageLive(_14); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + StorageLive(_15); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:14 + _15 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+20:17: +20:24 + StorageLive(_16); // scope 8 at $DIR/reference_prop.rs:+21:13: +21:14 + _16 = &_15; // scope 8 at $DIR/reference_prop.rs:+21:17: +21:19 + StorageLive(_17); // scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 + _17 = &_16; // scope 9 at $DIR/reference_prop.rs:+22:17: +22:19 + StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 +- _18 = (*_16); // scope 10 at $DIR/reference_prop.rs:+23:17: +23:19 +- _14 = const (); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 ++ _18 = _15; // scope 10 at $DIR/reference_prop.rs:+23:17: +23:19 + StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_17); // scope 9 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_16); // scope 8 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_15); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 +- StorageDead(_14); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 +- StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + StorageLive(_20); // scope 0 at $DIR/reference_prop.rs:+28:13: +28:14 + _20 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+28:17: +28:24 + StorageLive(_21); // scope 12 at $DIR/reference_prop.rs:+29:13: +29:18 + _21 = &_20; // scope 12 at $DIR/reference_prop.rs:+29:21: +29:23 + StorageLive(_22); // scope 13 at $DIR/reference_prop.rs:+30:13: +30:14 + _22 = &mut _21; // scope 13 at $DIR/reference_prop.rs:+30:17: +30:23 + StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+31:13: +31:14 + _23 = (*_21); // scope 14 at $DIR/reference_prop.rs:+31:17: +31:19 +- _19 = const (); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_22); // scope 13 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_21); // scope 12 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_20); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 +- StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 +- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+36:13: +36:14 + _25 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+36:17: +36:24 + StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+37:13: +37:14 + _26 = &_25; // scope 16 at $DIR/reference_prop.rs:+37:17: +37:19 + StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+38:13: +38:14 +- _27 = (*_26); // scope 17 at $DIR/reference_prop.rs:+38:17: +38:19 ++ _27 = _25; // scope 17 at $DIR/reference_prop.rs:+38:17: +38:19 + StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+39:9: +39:18 + StorageLive(_29); // scope 18 at $DIR/reference_prop.rs:+39:16: +39:17 + _29 = _26; // scope 18 at $DIR/reference_prop.rs:+39:16: +39:17 + _28 = opaque::<&usize>(move _29) -> bb1; // scope 18 at $DIR/reference_prop.rs:+39:9: +39:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:48:9: 48:15 + // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } + } + + bb1: { + StorageDead(_29); // scope 18 at $DIR/reference_prop.rs:+39:17: +39:18 + StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+39:18: +39:19 +- _24 = const (); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+40:5: +40:6 + StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+40:5: +40:6 + StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 +- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 +- StorageLive(_30); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+44:13: +44:14 + _31 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+44:17: +44:24 + StorageLive(_32); // scope 19 at $DIR/reference_prop.rs:+45:13: +45:15 + _32 = &_31; // scope 19 at $DIR/reference_prop.rs:+45:18: +45:20 + StorageLive(_33); // scope 20 at $DIR/reference_prop.rs:+46:13: +46:14 +- _33 = (*_32); // scope 20 at $DIR/reference_prop.rs:+46:17: +46:20 ++ _33 = _31; // scope 20 at $DIR/reference_prop.rs:+46:17: +46:20 + StorageLive(_34); // scope 21 at $DIR/reference_prop.rs:+47:13: +47:15 + _34 = _32; // scope 21 at $DIR/reference_prop.rs:+47:18: +47:20 + StorageLive(_35); // scope 22 at $DIR/reference_prop.rs:+48:13: +48:15 +- _35 = (*_34); // scope 22 at $DIR/reference_prop.rs:+48:18: +48:21 ++ _35 = _31; // scope 22 at $DIR/reference_prop.rs:+48:18: +48:21 + StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+49:13: +49:15 + _36 = _34; // scope 23 at $DIR/reference_prop.rs:+49:18: +49:20 + StorageLive(_37); // scope 24 at $DIR/reference_prop.rs:+52:9: +52:19 + StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+52:16: +52:18 + _38 = _36; // scope 24 at $DIR/reference_prop.rs:+52:16: +52:18 + _37 = opaque::<&usize>(move _38) -> bb2; // scope 24 at $DIR/reference_prop.rs:+52:9: +52:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:61:9: 61:15 + // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } + } + + bb2: { + StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+52:18: +52:19 + StorageDead(_37); // scope 24 at $DIR/reference_prop.rs:+52:19: +52:20 +- _30 = const (); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_35); // scope 22 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_34); // scope 21 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_33); // scope 20 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_32); // scope 19 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 +- StorageDead(_30); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 +- StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 + StorageLive(_40); // scope 0 at $DIR/reference_prop.rs:+57:13: +57:14 + _40 = &(*_1); // scope 0 at $DIR/reference_prop.rs:+57:17: +57:25 + StorageLive(_41); // scope 25 at $DIR/reference_prop.rs:+58:13: +58:14 +- _41 = (*_40); // scope 25 at $DIR/reference_prop.rs:+58:17: +58:19 +- _39 = const (); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 ++ _41 = (*_1); // scope 25 at $DIR/reference_prop.rs:+58:17: +58:19 + StorageDead(_41); // scope 25 at $DIR/reference_prop.rs:+59:5: +59:6 + StorageDead(_40); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 +- StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 + StorageLive(_42); // scope 0 at $DIR/reference_prop.rs:+63:13: +63:14 + _42 = &(*_2); // scope 0 at $DIR/reference_prop.rs:+63:17: +63:27 + StorageLive(_43); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 +- StorageLive(_44); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 +- _44 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 +- _43 = &(*_44); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 ++ _43 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 + _2 = move _43; // scope 27 at $DIR/reference_prop.rs:+64:9: +64:28 + StorageDead(_43); // scope 27 at $DIR/reference_prop.rs:+64:27: +64:28 +- StorageDead(_44); // scope 27 at $DIR/reference_prop.rs:+64:28: +64:29 + StorageLive(_45); // scope 27 at $DIR/reference_prop.rs:+65:13: +65:14 + _45 = (*_42); // scope 27 at $DIR/reference_prop.rs:+65:17: +65:19 + _0 = const (); // scope 0 at $DIR/reference_prop.rs:+62:5: +66:6 + StorageDead(_45); // scope 27 at $DIR/reference_prop.rs:+66:5: +66:6 + StorageDead(_42); // scope 0 at $DIR/reference_prop.rs:+66:5: +66:6 + return; // scope 0 at $DIR/reference_prop.rs:+67:2: +67:2 + } + } + diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff new file mode 100644 index 000000000000..2e6097af2c98 --- /dev/null +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -0,0 +1,334 @@ +- // MIR for `reference_propagation_const_ptr` before ReferencePropagation ++ // MIR for `reference_propagation_const_ptr` after ReferencePropagation + + fn reference_propagation_const_ptr(_1: *const T, _2: *const T) -> () { + debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:45: +0:51 + debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:63: +0:75 + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + let mut _11: *const usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:26 + let _13: (); // in scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + let _18: (); // in scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + let _23: (); // in scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + let _27: (); // in scope 0 at $DIR/reference_prop.rs:+39:9: +39:18 + let mut _28: *const usize; // in scope 0 at $DIR/reference_prop.rs:+39:16: +39:17 + let _29: (); // in scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + let _36: (); // in scope 0 at $DIR/reference_prop.rs:+52:9: +52:19 + let mut _37: *const usize; // in scope 0 at $DIR/reference_prop.rs:+52:16: +52:18 + let _38: (); // in scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 + let _41: (); // in scope 0 at $DIR/reference_prop.rs:+62:5: +66:6 + let mut _43: *const T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:38 + scope 1 { + let _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 + scope 2 { + debug a => _4; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:14 + let _5: *const usize; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + scope 3 { + debug b => _5; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14 + let _6: usize; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 + scope 4 { + debug c => _6; // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14 + } + } + } + } + scope 5 { + let _8: usize; // in scope 5 at $DIR/reference_prop.rs:+10:13: +10:14 + scope 6 { + debug a => _8; // in scope 6 at $DIR/reference_prop.rs:+10:13: +10:14 + let _9: usize; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:15 + scope 7 { + debug a2 => _9; // in scope 7 at $DIR/reference_prop.rs:+11:13: +11:15 + let mut _10: *const usize; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:18 + scope 8 { + debug b => _10; // in scope 8 at $DIR/reference_prop.rs:+12:13: +12:18 + let _12: usize; // in scope 8 at $DIR/reference_prop.rs:+15:13: +15:14 + scope 9 { + debug c => _12; // in scope 9 at $DIR/reference_prop.rs:+15:13: +15:14 + } + } + } + } + } + scope 10 { + let _14: usize; // in scope 10 at $DIR/reference_prop.rs:+20:13: +20:14 + scope 11 { + debug a => _14; // in scope 11 at $DIR/reference_prop.rs:+20:13: +20:14 + let _15: *const usize; // in scope 11 at $DIR/reference_prop.rs:+21:13: +21:14 + scope 12 { + debug b => _15; // in scope 12 at $DIR/reference_prop.rs:+21:13: +21:14 + let _16: &*const usize; // in scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 + scope 13 { + debug d => _16; // in scope 13 at $DIR/reference_prop.rs:+22:13: +22:14 + let _17: usize; // in scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 + scope 14 { + debug c => _17; // in scope 14 at $DIR/reference_prop.rs:+23:13: +23:14 + } + } + } + } + } + scope 15 { + let _19: usize; // in scope 15 at $DIR/reference_prop.rs:+28:13: +28:14 + scope 16 { + debug a => _19; // in scope 16 at $DIR/reference_prop.rs:+28:13: +28:14 + let mut _20: *const usize; // in scope 16 at $DIR/reference_prop.rs:+29:13: +29:18 + scope 17 { + debug b => _20; // in scope 17 at $DIR/reference_prop.rs:+29:13: +29:18 + let _21: &mut *const usize; // in scope 17 at $DIR/reference_prop.rs:+30:13: +30:14 + scope 18 { + debug d => _21; // in scope 18 at $DIR/reference_prop.rs:+30:13: +30:14 + let _22: usize; // in scope 18 at $DIR/reference_prop.rs:+31:13: +31:14 + scope 19 { + debug c => _22; // in scope 19 at $DIR/reference_prop.rs:+31:13: +31:14 + } + } + } + } + } + scope 20 { + let _24: usize; // in scope 20 at $DIR/reference_prop.rs:+36:13: +36:14 + scope 21 { + debug a => _24; // in scope 21 at $DIR/reference_prop.rs:+36:13: +36:14 + let _25: *const usize; // in scope 21 at $DIR/reference_prop.rs:+37:13: +37:14 + scope 22 { + debug b => _25; // in scope 22 at $DIR/reference_prop.rs:+37:13: +37:14 + let _26: usize; // in scope 22 at $DIR/reference_prop.rs:+38:13: +38:14 + scope 23 { + debug c => _26; // in scope 23 at $DIR/reference_prop.rs:+38:13: +38:14 + } + } + } + } + scope 24 { + let _30: usize; // in scope 24 at $DIR/reference_prop.rs:+44:13: +44:14 + scope 25 { + debug a => _30; // in scope 25 at $DIR/reference_prop.rs:+44:13: +44:14 + let _31: *const usize; // in scope 25 at $DIR/reference_prop.rs:+45:13: +45:15 + scope 26 { + debug b1 => _31; // in scope 26 at $DIR/reference_prop.rs:+45:13: +45:15 + let _32: usize; // in scope 26 at $DIR/reference_prop.rs:+46:13: +46:14 + scope 27 { + debug c => _32; // in scope 27 at $DIR/reference_prop.rs:+46:13: +46:14 + let _33: *const usize; // in scope 27 at $DIR/reference_prop.rs:+47:13: +47:15 + scope 28 { + debug b2 => _33; // in scope 28 at $DIR/reference_prop.rs:+47:13: +47:15 + let _34: usize; // in scope 28 at $DIR/reference_prop.rs:+48:13: +48:15 + scope 29 { + debug c2 => _34; // in scope 29 at $DIR/reference_prop.rs:+48:13: +48:15 + let _35: *const usize; // in scope 29 at $DIR/reference_prop.rs:+49:13: +49:15 + scope 30 { + debug b3 => _35; // in scope 30 at $DIR/reference_prop.rs:+49:13: +49:15 + } + } + } + } + } + } + } + scope 31 { + let _39: *const T; // in scope 31 at $DIR/reference_prop.rs:+57:13: +57:14 + scope 32 { + debug a => _39; // in scope 32 at $DIR/reference_prop.rs:+57:13: +57:14 + let _40: T; // in scope 32 at $DIR/reference_prop.rs:+58:13: +58:14 + scope 33 { + debug b => _40; // in scope 33 at $DIR/reference_prop.rs:+58:13: +58:14 + } + } + } + scope 34 { + let _42: *const T; // in scope 34 at $DIR/reference_prop.rs:+63:13: +63:14 + scope 35 { + debug a => _42; // in scope 35 at $DIR/reference_prop.rs:+63:13: +63:14 + let _44: T; // in scope 35 at $DIR/reference_prop.rs:+65:13: +65:14 + scope 36 { + debug b => _44; // in scope 36 at $DIR/reference_prop.rs:+65:13: +65:14 + } + } + } + scope 37 { + let _45: usize; // in scope 37 at $DIR/reference_prop.rs:+70:13: +70:14 + scope 38 { + debug a => _45; // in scope 38 at $DIR/reference_prop.rs:+70:13: +70:14 + let _46: *const usize; // in scope 38 at $DIR/reference_prop.rs:+71:13: +71:14 + scope 39 { + debug b => _46; // in scope 39 at $DIR/reference_prop.rs:+71:13: +71:14 + let _47: *const usize; // in scope 39 at $DIR/reference_prop.rs:+72:13: +72:14 + scope 40 { + debug c => _47; // in scope 40 at $DIR/reference_prop.rs:+72:13: +72:14 + let _48: usize; // in scope 40 at $DIR/reference_prop.rs:+73:13: +73:14 + scope 41 { + debug e => _48; // in scope 41 at $DIR/reference_prop.rs:+73:13: +73:14 + } + } + } + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 + _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:17: +3:24 + StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + _5 = &raw const _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:29 + StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 +- _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 +- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +6:6 ++ _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 + StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+6:5: +6:6 + StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+6:5: +6:6 + StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+6:5: +6:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 +- StorageLive(_7); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + StorageLive(_8); // scope 5 at $DIR/reference_prop.rs:+10:13: +10:14 + _8 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+10:17: +10:24 + StorageLive(_9); // scope 6 at $DIR/reference_prop.rs:+11:13: +11:15 + _9 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+11:18: +11:25 + StorageLive(_10); // scope 7 at $DIR/reference_prop.rs:+12:13: +12:18 + _10 = &raw const _8; // scope 7 at $DIR/reference_prop.rs:+12:21: +12:33 + StorageLive(_11); // scope 8 at $DIR/reference_prop.rs:+13:13: +13:26 + _11 = &raw const _9; // scope 8 at $DIR/reference_prop.rs:+13:13: +13:26 + _10 = move _11; // scope 8 at $DIR/reference_prop.rs:+13:9: +13:26 + StorageDead(_11); // scope 8 at $DIR/reference_prop.rs:+13:25: +13:26 + StorageLive(_12); // scope 8 at $DIR/reference_prop.rs:+15:13: +15:14 + _12 = (*_10); // scope 8 at $DIR/reference_prop.rs:+15:17: +15:19 +- _7 = const (); // scope 5 at $DIR/reference_prop.rs:+9:5: +16:6 + StorageDead(_12); // scope 8 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_10); // scope 7 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_9); // scope 6 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_8); // scope 5 at $DIR/reference_prop.rs:+16:5: +16:6 +- StorageDead(_7); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 +- StorageLive(_13); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + StorageLive(_14); // scope 10 at $DIR/reference_prop.rs:+20:13: +20:14 + _14 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+20:17: +20:24 + StorageLive(_15); // scope 11 at $DIR/reference_prop.rs:+21:13: +21:14 + _15 = &raw const _14; // scope 11 at $DIR/reference_prop.rs:+21:17: +21:29 + StorageLive(_16); // scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 + _16 = &_15; // scope 12 at $DIR/reference_prop.rs:+22:17: +22:19 + StorageLive(_17); // scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 +- _17 = (*_15); // scope 13 at $DIR/reference_prop.rs:+23:17: +23:19 +- _13 = const (); // scope 10 at $DIR/reference_prop.rs:+19:5: +24:6 ++ _17 = _14; // scope 13 at $DIR/reference_prop.rs:+23:17: +23:19 + StorageDead(_17); // scope 13 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_16); // scope 12 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_15); // scope 11 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_14); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 +- StorageDead(_13); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 +- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + StorageLive(_19); // scope 15 at $DIR/reference_prop.rs:+28:13: +28:14 + _19 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+28:17: +28:24 + StorageLive(_20); // scope 16 at $DIR/reference_prop.rs:+29:13: +29:18 + _20 = &raw const _19; // scope 16 at $DIR/reference_prop.rs:+29:21: +29:33 + StorageLive(_21); // scope 17 at $DIR/reference_prop.rs:+30:13: +30:14 + _21 = &mut _20; // scope 17 at $DIR/reference_prop.rs:+30:17: +30:23 + StorageLive(_22); // scope 18 at $DIR/reference_prop.rs:+31:13: +31:14 + _22 = (*_20); // scope 18 at $DIR/reference_prop.rs:+31:17: +31:19 +- _18 = const (); // scope 15 at $DIR/reference_prop.rs:+27:5: +32:6 + StorageDead(_22); // scope 18 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_21); // scope 17 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_20); // scope 16 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_19); // scope 15 at $DIR/reference_prop.rs:+32:5: +32:6 +- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 +- StorageLive(_23); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + StorageLive(_24); // scope 20 at $DIR/reference_prop.rs:+36:13: +36:14 + _24 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+36:17: +36:24 + StorageLive(_25); // scope 21 at $DIR/reference_prop.rs:+37:13: +37:14 + _25 = &raw const _24; // scope 21 at $DIR/reference_prop.rs:+37:17: +37:29 + StorageLive(_26); // scope 22 at $DIR/reference_prop.rs:+38:13: +38:14 +- _26 = (*_25); // scope 22 at $DIR/reference_prop.rs:+38:17: +38:19 ++ _26 = _24; // scope 22 at $DIR/reference_prop.rs:+38:17: +38:19 + StorageLive(_27); // scope 23 at $DIR/reference_prop.rs:+39:9: +39:18 + StorageLive(_28); // scope 23 at $DIR/reference_prop.rs:+39:16: +39:17 + _28 = _25; // scope 23 at $DIR/reference_prop.rs:+39:16: +39:17 + _27 = opaque::<*const usize>(move _28) -> bb1; // scope 23 at $DIR/reference_prop.rs:+39:9: +39:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:186:9: 186:15 + // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } + } + + bb1: { + StorageDead(_28); // scope 23 at $DIR/reference_prop.rs:+39:17: +39:18 + StorageDead(_27); // scope 23 at $DIR/reference_prop.rs:+39:18: +39:19 +- _23 = const (); // scope 20 at $DIR/reference_prop.rs:+35:5: +40:6 + StorageDead(_26); // scope 22 at $DIR/reference_prop.rs:+40:5: +40:6 + StorageDead(_25); // scope 21 at $DIR/reference_prop.rs:+40:5: +40:6 + StorageDead(_24); // scope 20 at $DIR/reference_prop.rs:+40:5: +40:6 +- StorageDead(_23); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 +- StorageLive(_29); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + StorageLive(_30); // scope 24 at $DIR/reference_prop.rs:+44:13: +44:14 + _30 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+44:17: +44:24 + StorageLive(_31); // scope 25 at $DIR/reference_prop.rs:+45:13: +45:15 + _31 = &raw const _30; // scope 25 at $DIR/reference_prop.rs:+45:18: +45:30 + StorageLive(_32); // scope 26 at $DIR/reference_prop.rs:+46:13: +46:14 +- _32 = (*_31); // scope 26 at $DIR/reference_prop.rs:+46:17: +46:20 ++ _32 = _30; // scope 26 at $DIR/reference_prop.rs:+46:17: +46:20 + StorageLive(_33); // scope 27 at $DIR/reference_prop.rs:+47:13: +47:15 + _33 = _31; // scope 27 at $DIR/reference_prop.rs:+47:18: +47:20 + StorageLive(_34); // scope 28 at $DIR/reference_prop.rs:+48:13: +48:15 +- _34 = (*_33); // scope 28 at $DIR/reference_prop.rs:+48:18: +48:21 ++ _34 = _30; // scope 28 at $DIR/reference_prop.rs:+48:18: +48:21 + StorageLive(_35); // scope 29 at $DIR/reference_prop.rs:+49:13: +49:15 + _35 = _33; // scope 29 at $DIR/reference_prop.rs:+49:18: +49:20 + StorageLive(_36); // scope 30 at $DIR/reference_prop.rs:+52:9: +52:19 + StorageLive(_37); // scope 30 at $DIR/reference_prop.rs:+52:16: +52:18 + _37 = _35; // scope 30 at $DIR/reference_prop.rs:+52:16: +52:18 + _36 = opaque::<*const usize>(move _37) -> bb2; // scope 30 at $DIR/reference_prop.rs:+52:9: +52:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:199:9: 199:15 + // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } + } + + bb2: { + StorageDead(_37); // scope 30 at $DIR/reference_prop.rs:+52:18: +52:19 + StorageDead(_36); // scope 30 at $DIR/reference_prop.rs:+52:19: +52:20 +- _29 = const (); // scope 24 at $DIR/reference_prop.rs:+43:5: +53:6 + StorageDead(_35); // scope 29 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_34); // scope 28 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_33); // scope 27 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_32); // scope 26 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_31); // scope 25 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_30); // scope 24 at $DIR/reference_prop.rs:+53:5: +53:6 +- StorageDead(_29); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 +- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 + StorageLive(_39); // scope 31 at $DIR/reference_prop.rs:+57:13: +57:14 + _39 = &raw const (*_1); // scope 31 at $DIR/reference_prop.rs:+57:17: +57:35 + StorageLive(_40); // scope 32 at $DIR/reference_prop.rs:+58:13: +58:14 +- _40 = (*_39); // scope 32 at $DIR/reference_prop.rs:+58:17: +58:19 +- _38 = const (); // scope 31 at $DIR/reference_prop.rs:+56:5: +59:6 ++ _40 = (*_1); // scope 32 at $DIR/reference_prop.rs:+58:17: +58:19 + StorageDead(_40); // scope 32 at $DIR/reference_prop.rs:+59:5: +59:6 + StorageDead(_39); // scope 31 at $DIR/reference_prop.rs:+59:5: +59:6 +- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 +- StorageLive(_41); // scope 0 at $DIR/reference_prop.rs:+62:5: +66:6 + StorageLive(_42); // scope 34 at $DIR/reference_prop.rs:+63:13: +63:14 + _42 = &raw const (*_2); // scope 34 at $DIR/reference_prop.rs:+63:17: +63:37 + StorageLive(_43); // scope 35 at $DIR/reference_prop.rs:+64:20: +64:38 + _43 = &raw const (*_1); // scope 35 at $DIR/reference_prop.rs:+64:20: +64:38 + _2 = move _43; // scope 35 at $DIR/reference_prop.rs:+64:9: +64:38 + StorageDead(_43); // scope 35 at $DIR/reference_prop.rs:+64:37: +64:38 + StorageLive(_44); // scope 35 at $DIR/reference_prop.rs:+65:13: +65:14 + _44 = (*_42); // scope 35 at $DIR/reference_prop.rs:+65:17: +65:19 +- _41 = const (); // scope 34 at $DIR/reference_prop.rs:+62:5: +66:6 + StorageDead(_44); // scope 35 at $DIR/reference_prop.rs:+66:5: +66:6 + StorageDead(_42); // scope 34 at $DIR/reference_prop.rs:+66:5: +66:6 +- StorageDead(_41); // scope 0 at $DIR/reference_prop.rs:+66:5: +66:6 + StorageLive(_45); // scope 37 at $DIR/reference_prop.rs:+70:13: +70:14 + _45 = const 13_usize; // scope 37 at $DIR/reference_prop.rs:+70:17: +70:25 + StorageLive(_46); // scope 38 at $DIR/reference_prop.rs:+71:13: +71:14 + _46 = &raw const _45; // scope 38 at $DIR/reference_prop.rs:+71:17: +71:29 + StorageLive(_47); // scope 39 at $DIR/reference_prop.rs:+72:13: +72:14 +- _47 = &raw const (*_46); // scope 39 at $DIR/reference_prop.rs:+72:17: +72:30 ++ _47 = &raw const _45; // scope 39 at $DIR/reference_prop.rs:+72:17: +72:30 + StorageLive(_48); // scope 40 at $DIR/reference_prop.rs:+73:13: +73:14 +- _48 = (*_47); // scope 40 at $DIR/reference_prop.rs:+73:17: +73:19 ++ _48 = _45; // scope 40 at $DIR/reference_prop.rs:+73:17: +73:19 + _0 = const (); // scope 37 at $DIR/reference_prop.rs:+69:5: +74:6 + StorageDead(_48); // scope 40 at $DIR/reference_prop.rs:+74:5: +74:6 + StorageDead(_47); // scope 39 at $DIR/reference_prop.rs:+74:5: +74:6 + StorageDead(_46); // scope 38 at $DIR/reference_prop.rs:+74:5: +74:6 + StorageDead(_45); // scope 37 at $DIR/reference_prop.rs:+74:5: +74:6 + return; // scope 0 at $DIR/reference_prop.rs:+75:2: +75:2 + } + } + diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff new file mode 100644 index 000000000000..f7bbd2a03f90 --- /dev/null +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -0,0 +1,288 @@ +- // MIR for `reference_propagation_mut` before ReferencePropagation ++ // MIR for `reference_propagation_mut` after ReferencePropagation + + fn reference_propagation_mut(_1: &mut T, _2: &mut T) -> () { + debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49 + debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:62: +0:74 + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + let mut _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:18 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + let mut _8: usize; // in scope 0 at $DIR/reference_prop.rs:+10:13: +10:18 + let mut _11: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:20 + let mut _12: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:20 + let _14: (); // in scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + let mut _15: usize; // in scope 0 at $DIR/reference_prop.rs:+20:13: +20:18 + let _19: (); // in scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + let mut _20: usize; // in scope 0 at $DIR/reference_prop.rs:+28:13: +28:18 + let _24: (); // in scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + let mut _25: usize; // in scope 0 at $DIR/reference_prop.rs:+36:13: +36:18 + let _28: (); // in scope 0 at $DIR/reference_prop.rs:+39:9: +39:18 + let mut _29: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+39:16: +39:17 + let _30: (); // in scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + let mut _31: usize; // in scope 0 at $DIR/reference_prop.rs:+44:13: +44:18 + let _37: (); // in scope 0 at $DIR/reference_prop.rs:+52:9: +52:19 + let mut _38: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+52:16: +52:18 + let _39: (); // in scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 + let _40: &mut T; // in scope 0 at $DIR/reference_prop.rs:+57:13: +57:14 + let _42: &mut T; // in scope 0 at $DIR/reference_prop.rs:+63:13: +63:14 + let mut _43: &mut T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:32 + let mut _44: &mut T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:32 + scope 1 { + debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 + let _5: &mut usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 + scope 2 { + debug b => _5; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + let _6: usize; // in scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 + scope 3 { + debug c => _6; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 + } + } + } + scope 4 { + debug a => _8; // in scope 4 at $DIR/reference_prop.rs:+10:13: +10:18 + let mut _9: usize; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:19 + scope 5 { + debug a2 => _9; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:19 + let mut _10: &mut usize; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:18 + scope 6 { + debug b => _10; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:18 + let _13: usize; // in scope 6 at $DIR/reference_prop.rs:+15:13: +15:14 + scope 7 { + debug c => _13; // in scope 7 at $DIR/reference_prop.rs:+15:13: +15:14 + } + } + } + } + scope 8 { + debug a => _15; // in scope 8 at $DIR/reference_prop.rs:+20:13: +20:18 + let _16: &mut usize; // in scope 8 at $DIR/reference_prop.rs:+21:13: +21:14 + scope 9 { + debug b => _16; // in scope 9 at $DIR/reference_prop.rs:+21:13: +21:14 + let _17: &&mut usize; // in scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 + scope 10 { + debug d => _17; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:14 + let _18: usize; // in scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 + scope 11 { + debug c => _18; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + } + } + } + } + scope 12 { + debug a => _20; // in scope 12 at $DIR/reference_prop.rs:+28:13: +28:18 + let mut _21: &mut usize; // in scope 12 at $DIR/reference_prop.rs:+29:13: +29:18 + scope 13 { + debug b => _21; // in scope 13 at $DIR/reference_prop.rs:+29:13: +29:18 + let _22: &mut &mut usize; // in scope 13 at $DIR/reference_prop.rs:+30:13: +30:14 + scope 14 { + debug d => _22; // in scope 14 at $DIR/reference_prop.rs:+30:13: +30:14 + let _23: usize; // in scope 14 at $DIR/reference_prop.rs:+31:13: +31:14 + scope 15 { + debug c => _23; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:14 + } + } + } + } + scope 16 { + debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+36:13: +36:18 + let _26: &mut usize; // in scope 16 at $DIR/reference_prop.rs:+37:13: +37:14 + scope 17 { + debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+37:13: +37:14 + let _27: usize; // in scope 17 at $DIR/reference_prop.rs:+38:13: +38:14 + scope 18 { + debug c => _27; // in scope 18 at $DIR/reference_prop.rs:+38:13: +38:14 + } + } + } + scope 19 { + debug a => _31; // in scope 19 at $DIR/reference_prop.rs:+44:13: +44:18 + let _32: &mut usize; // in scope 19 at $DIR/reference_prop.rs:+45:13: +45:15 + scope 20 { + debug b1 => _32; // in scope 20 at $DIR/reference_prop.rs:+45:13: +45:15 + let _33: usize; // in scope 20 at $DIR/reference_prop.rs:+46:13: +46:14 + scope 21 { + debug c => _33; // in scope 21 at $DIR/reference_prop.rs:+46:13: +46:14 + let _34: &mut usize; // in scope 21 at $DIR/reference_prop.rs:+47:13: +47:15 + scope 22 { + debug b2 => _34; // in scope 22 at $DIR/reference_prop.rs:+47:13: +47:15 + let _35: usize; // in scope 22 at $DIR/reference_prop.rs:+48:13: +48:15 + scope 23 { + debug c2 => _35; // in scope 23 at $DIR/reference_prop.rs:+48:13: +48:15 + let _36: &mut usize; // in scope 23 at $DIR/reference_prop.rs:+49:13: +49:15 + scope 24 { + debug b3 => _36; // in scope 24 at $DIR/reference_prop.rs:+49:13: +49:15 + } + } + } + } + } + } + scope 25 { + debug a => _40; // in scope 25 at $DIR/reference_prop.rs:+57:13: +57:14 + let _41: T; // in scope 25 at $DIR/reference_prop.rs:+58:13: +58:14 + scope 26 { + debug b => _41; // in scope 26 at $DIR/reference_prop.rs:+58:13: +58:14 + } + } + scope 27 { + debug a => _42; // in scope 27 at $DIR/reference_prop.rs:+63:13: +63:14 + let _45: T; // in scope 27 at $DIR/reference_prop.rs:+65:13: +65:14 + scope 28 { + debug b => _45; // in scope 28 at $DIR/reference_prop.rs:+65:13: +65:14 + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:18 + _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:21: +3:28 + StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 + _5 = &mut _4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:23 + StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 +- _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 +- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 ++ _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 + StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+6:5: +6:6 + StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+6:5: +6:6 + StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 +- StorageLive(_7); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + StorageLive(_8); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18 + _8 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+10:21: +10:28 + StorageLive(_9); // scope 4 at $DIR/reference_prop.rs:+11:13: +11:19 + _9 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+11:22: +11:29 + StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+12:13: +12:18 + _10 = &mut _8; // scope 5 at $DIR/reference_prop.rs:+12:21: +12:27 + StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 +- StorageLive(_12); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 +- _12 = &mut _9; // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 +- _11 = &mut (*_12); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 ++ _11 = &mut _9; // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 + _10 = move _11; // scope 6 at $DIR/reference_prop.rs:+13:9: +13:20 + StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+13:19: +13:20 +- StorageDead(_12); // scope 6 at $DIR/reference_prop.rs:+13:20: +13:21 + StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+15:13: +15:14 + _13 = (*_10); // scope 6 at $DIR/reference_prop.rs:+15:17: +15:19 +- _7 = const (); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_9); // scope 4 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_8); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 +- StorageDead(_7); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 +- StorageLive(_14); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + StorageLive(_15); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:18 + _15 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+20:21: +20:28 + StorageLive(_16); // scope 8 at $DIR/reference_prop.rs:+21:13: +21:14 + _16 = &mut _15; // scope 8 at $DIR/reference_prop.rs:+21:17: +21:23 + StorageLive(_17); // scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 + _17 = &_16; // scope 9 at $DIR/reference_prop.rs:+22:17: +22:19 + StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 + _18 = (*_16); // scope 10 at $DIR/reference_prop.rs:+23:17: +23:19 +- _14 = const (); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_17); // scope 9 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_16); // scope 8 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_15); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 +- StorageDead(_14); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 +- StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + StorageLive(_20); // scope 0 at $DIR/reference_prop.rs:+28:13: +28:18 + _20 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+28:21: +28:28 + StorageLive(_21); // scope 12 at $DIR/reference_prop.rs:+29:13: +29:18 + _21 = &mut _20; // scope 12 at $DIR/reference_prop.rs:+29:21: +29:27 + StorageLive(_22); // scope 13 at $DIR/reference_prop.rs:+30:13: +30:14 + _22 = &mut _21; // scope 13 at $DIR/reference_prop.rs:+30:17: +30:23 + StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+31:13: +31:14 + _23 = (*_21); // scope 14 at $DIR/reference_prop.rs:+31:17: +31:19 +- _19 = const (); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_22); // scope 13 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_21); // scope 12 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_20); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 +- StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 +- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+36:13: +36:18 + _25 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+36:21: +36:28 + StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+37:13: +37:14 + _26 = &mut _25; // scope 16 at $DIR/reference_prop.rs:+37:17: +37:23 + StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+38:13: +38:14 + _27 = (*_26); // scope 17 at $DIR/reference_prop.rs:+38:17: +38:19 + StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+39:9: +39:18 + StorageLive(_29); // scope 18 at $DIR/reference_prop.rs:+39:16: +39:17 + _29 = move _26; // scope 18 at $DIR/reference_prop.rs:+39:16: +39:17 + _28 = opaque::<&mut usize>(move _29) -> bb1; // scope 18 at $DIR/reference_prop.rs:+39:9: +39:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:117:9: 117:15 + // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } + } + + bb1: { + StorageDead(_29); // scope 18 at $DIR/reference_prop.rs:+39:17: +39:18 + StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+39:18: +39:19 +- _24 = const (); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+40:5: +40:6 + StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+40:5: +40:6 + StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 +- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 +- StorageLive(_30); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+44:13: +44:18 + _31 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+44:21: +44:28 + StorageLive(_32); // scope 19 at $DIR/reference_prop.rs:+45:13: +45:15 + _32 = &mut _31; // scope 19 at $DIR/reference_prop.rs:+45:18: +45:24 + StorageLive(_33); // scope 20 at $DIR/reference_prop.rs:+46:13: +46:14 + _33 = (*_32); // scope 20 at $DIR/reference_prop.rs:+46:17: +46:20 + StorageLive(_34); // scope 21 at $DIR/reference_prop.rs:+47:13: +47:15 + _34 = move _32; // scope 21 at $DIR/reference_prop.rs:+47:18: +47:20 + StorageLive(_35); // scope 22 at $DIR/reference_prop.rs:+48:13: +48:15 + _35 = (*_34); // scope 22 at $DIR/reference_prop.rs:+48:18: +48:21 + StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+49:13: +49:15 + _36 = move _34; // scope 23 at $DIR/reference_prop.rs:+49:18: +49:20 + StorageLive(_37); // scope 24 at $DIR/reference_prop.rs:+52:9: +52:19 + StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+52:16: +52:18 + _38 = move _36; // scope 24 at $DIR/reference_prop.rs:+52:16: +52:18 + _37 = opaque::<&mut usize>(move _38) -> bb2; // scope 24 at $DIR/reference_prop.rs:+52:9: +52:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:130:9: 130:15 + // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } + } + + bb2: { + StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+52:18: +52:19 + StorageDead(_37); // scope 24 at $DIR/reference_prop.rs:+52:19: +52:20 +- _30 = const (); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_35); // scope 22 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_34); // scope 21 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_33); // scope 20 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_32); // scope 19 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 +- StorageDead(_30); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 +- StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 + StorageLive(_40); // scope 0 at $DIR/reference_prop.rs:+57:13: +57:14 + _40 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+57:17: +57:29 + StorageLive(_41); // scope 25 at $DIR/reference_prop.rs:+58:13: +58:14 +- _41 = (*_40); // scope 25 at $DIR/reference_prop.rs:+58:17: +58:19 +- _39 = const (); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 ++ _41 = (*_1); // scope 25 at $DIR/reference_prop.rs:+58:17: +58:19 + StorageDead(_41); // scope 25 at $DIR/reference_prop.rs:+59:5: +59:6 + StorageDead(_40); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 +- StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 + StorageLive(_42); // scope 0 at $DIR/reference_prop.rs:+63:13: +63:14 + _42 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+63:17: +63:31 + StorageLive(_43); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 +- StorageLive(_44); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 +- _44 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 +- _43 = &mut (*_44); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 ++ _43 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 + _2 = move _43; // scope 27 at $DIR/reference_prop.rs:+64:9: +64:32 + StorageDead(_43); // scope 27 at $DIR/reference_prop.rs:+64:31: +64:32 +- StorageDead(_44); // scope 27 at $DIR/reference_prop.rs:+64:32: +64:33 + StorageLive(_45); // scope 27 at $DIR/reference_prop.rs:+65:13: +65:14 + _45 = (*_42); // scope 27 at $DIR/reference_prop.rs:+65:17: +65:19 + _0 = const (); // scope 0 at $DIR/reference_prop.rs:+62:5: +66:6 + StorageDead(_45); // scope 27 at $DIR/reference_prop.rs:+66:5: +66:6 + StorageDead(_42); // scope 0 at $DIR/reference_prop.rs:+66:5: +66:6 + return; // scope 0 at $DIR/reference_prop.rs:+67:2: +67:2 + } + } + diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff new file mode 100644 index 000000000000..235964e95366 --- /dev/null +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -0,0 +1,294 @@ +- // MIR for `reference_propagation_mut_ptr` before ReferencePropagation ++ // MIR for `reference_propagation_mut_ptr` after ReferencePropagation + + fn reference_propagation_mut_ptr(_1: *mut T, _2: *mut T) -> () { + debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49 + debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:59: +0:71 + let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:81: +0:81 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + let mut _11: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:24 + let _13: (); // in scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + let _18: (); // in scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + let _23: (); // in scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + let _27: (); // in scope 0 at $DIR/reference_prop.rs:+39:9: +39:18 + let mut _28: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+39:16: +39:17 + let _29: (); // in scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + let _36: (); // in scope 0 at $DIR/reference_prop.rs:+52:9: +52:19 + let mut _37: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+52:16: +52:18 + let _38: (); // in scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 + let mut _42: *mut T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:36 + scope 1 { + let mut _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 + scope 2 { + debug a => _4; // in scope 2 at $DIR/reference_prop.rs:+3:13: +3:18 + let _5: *mut usize; // in scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + scope 3 { + debug b => _5; // in scope 3 at $DIR/reference_prop.rs:+4:13: +4:14 + let _6: usize; // in scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 + scope 4 { + debug c => _6; // in scope 4 at $DIR/reference_prop.rs:+5:13: +5:14 + } + } + } + } + scope 5 { + let mut _8: usize; // in scope 5 at $DIR/reference_prop.rs:+10:13: +10:18 + scope 6 { + debug a => _8; // in scope 6 at $DIR/reference_prop.rs:+10:13: +10:18 + let mut _9: usize; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:19 + scope 7 { + debug a2 => _9; // in scope 7 at $DIR/reference_prop.rs:+11:13: +11:19 + let mut _10: *mut usize; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:18 + scope 8 { + debug b => _10; // in scope 8 at $DIR/reference_prop.rs:+12:13: +12:18 + let _12: usize; // in scope 8 at $DIR/reference_prop.rs:+15:13: +15:14 + scope 9 { + debug c => _12; // in scope 9 at $DIR/reference_prop.rs:+15:13: +15:14 + } + } + } + } + } + scope 10 { + let mut _14: usize; // in scope 10 at $DIR/reference_prop.rs:+20:13: +20:18 + scope 11 { + debug a => _14; // in scope 11 at $DIR/reference_prop.rs:+20:13: +20:18 + let _15: *mut usize; // in scope 11 at $DIR/reference_prop.rs:+21:13: +21:14 + scope 12 { + debug b => _15; // in scope 12 at $DIR/reference_prop.rs:+21:13: +21:14 + let _16: &*mut usize; // in scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 + scope 13 { + debug d => _16; // in scope 13 at $DIR/reference_prop.rs:+22:13: +22:14 + let _17: usize; // in scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 + scope 14 { + debug c => _17; // in scope 14 at $DIR/reference_prop.rs:+23:13: +23:14 + } + } + } + } + } + scope 15 { + let mut _19: usize; // in scope 15 at $DIR/reference_prop.rs:+28:13: +28:18 + scope 16 { + debug a => _19; // in scope 16 at $DIR/reference_prop.rs:+28:13: +28:18 + let mut _20: *mut usize; // in scope 16 at $DIR/reference_prop.rs:+29:13: +29:18 + scope 17 { + debug b => _20; // in scope 17 at $DIR/reference_prop.rs:+29:13: +29:18 + let _21: &mut *mut usize; // in scope 17 at $DIR/reference_prop.rs:+30:13: +30:14 + scope 18 { + debug d => _21; // in scope 18 at $DIR/reference_prop.rs:+30:13: +30:14 + let _22: usize; // in scope 18 at $DIR/reference_prop.rs:+31:13: +31:14 + scope 19 { + debug c => _22; // in scope 19 at $DIR/reference_prop.rs:+31:13: +31:14 + } + } + } + } + } + scope 20 { + let mut _24: usize; // in scope 20 at $DIR/reference_prop.rs:+36:13: +36:18 + scope 21 { + debug a => _24; // in scope 21 at $DIR/reference_prop.rs:+36:13: +36:18 + let _25: *mut usize; // in scope 21 at $DIR/reference_prop.rs:+37:13: +37:14 + scope 22 { + debug b => _25; // in scope 22 at $DIR/reference_prop.rs:+37:13: +37:14 + let _26: usize; // in scope 22 at $DIR/reference_prop.rs:+38:13: +38:14 + scope 23 { + debug c => _26; // in scope 23 at $DIR/reference_prop.rs:+38:13: +38:14 + } + } + } + } + scope 24 { + let mut _30: usize; // in scope 24 at $DIR/reference_prop.rs:+44:13: +44:18 + scope 25 { + debug a => _30; // in scope 25 at $DIR/reference_prop.rs:+44:13: +44:18 + let _31: *mut usize; // in scope 25 at $DIR/reference_prop.rs:+45:13: +45:15 + scope 26 { + debug b1 => _31; // in scope 26 at $DIR/reference_prop.rs:+45:13: +45:15 + let _32: usize; // in scope 26 at $DIR/reference_prop.rs:+46:13: +46:14 + scope 27 { + debug c => _32; // in scope 27 at $DIR/reference_prop.rs:+46:13: +46:14 + let _33: *mut usize; // in scope 27 at $DIR/reference_prop.rs:+47:13: +47:15 + scope 28 { + debug b2 => _33; // in scope 28 at $DIR/reference_prop.rs:+47:13: +47:15 + let _34: usize; // in scope 28 at $DIR/reference_prop.rs:+48:13: +48:15 + scope 29 { + debug c2 => _34; // in scope 29 at $DIR/reference_prop.rs:+48:13: +48:15 + let _35: *mut usize; // in scope 29 at $DIR/reference_prop.rs:+49:13: +49:15 + scope 30 { + debug b3 => _35; // in scope 30 at $DIR/reference_prop.rs:+49:13: +49:15 + } + } + } + } + } + } + } + scope 31 { + let _39: *mut T; // in scope 31 at $DIR/reference_prop.rs:+57:13: +57:14 + scope 32 { + debug a => _39; // in scope 32 at $DIR/reference_prop.rs:+57:13: +57:14 + let _40: T; // in scope 32 at $DIR/reference_prop.rs:+58:13: +58:14 + scope 33 { + debug b => _40; // in scope 33 at $DIR/reference_prop.rs:+58:13: +58:14 + } + } + } + scope 34 { + let _41: *mut T; // in scope 34 at $DIR/reference_prop.rs:+63:13: +63:14 + scope 35 { + debug a => _41; // in scope 35 at $DIR/reference_prop.rs:+63:13: +63:14 + let _43: T; // in scope 35 at $DIR/reference_prop.rs:+65:13: +65:14 + scope 36 { + debug b => _43; // in scope 36 at $DIR/reference_prop.rs:+65:13: +65:14 + } + } + } + + bb0: { +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 + _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:21: +3:28 + StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 + _5 = &raw mut _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:27 + StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 +- _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 +- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +6:6 ++ _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 + StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+6:5: +6:6 + StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+6:5: +6:6 + StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+6:5: +6:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 +- StorageLive(_7); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 + StorageLive(_8); // scope 5 at $DIR/reference_prop.rs:+10:13: +10:18 + _8 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+10:21: +10:28 + StorageLive(_9); // scope 6 at $DIR/reference_prop.rs:+11:13: +11:19 + _9 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+11:22: +11:29 + StorageLive(_10); // scope 7 at $DIR/reference_prop.rs:+12:13: +12:18 + _10 = &raw mut _8; // scope 7 at $DIR/reference_prop.rs:+12:21: +12:31 + StorageLive(_11); // scope 8 at $DIR/reference_prop.rs:+13:13: +13:24 + _11 = &raw mut _9; // scope 8 at $DIR/reference_prop.rs:+13:13: +13:24 + _10 = move _11; // scope 8 at $DIR/reference_prop.rs:+13:9: +13:24 + StorageDead(_11); // scope 8 at $DIR/reference_prop.rs:+13:23: +13:24 + StorageLive(_12); // scope 8 at $DIR/reference_prop.rs:+15:13: +15:14 + _12 = (*_10); // scope 8 at $DIR/reference_prop.rs:+15:17: +15:19 +- _7 = const (); // scope 5 at $DIR/reference_prop.rs:+9:5: +16:6 + StorageDead(_12); // scope 8 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_10); // scope 7 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_9); // scope 6 at $DIR/reference_prop.rs:+16:5: +16:6 + StorageDead(_8); // scope 5 at $DIR/reference_prop.rs:+16:5: +16:6 +- StorageDead(_7); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 +- StorageLive(_13); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 + StorageLive(_14); // scope 10 at $DIR/reference_prop.rs:+20:13: +20:18 + _14 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+20:21: +20:28 + StorageLive(_15); // scope 11 at $DIR/reference_prop.rs:+21:13: +21:14 + _15 = &raw mut _14; // scope 11 at $DIR/reference_prop.rs:+21:17: +21:27 + StorageLive(_16); // scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 + _16 = &_15; // scope 12 at $DIR/reference_prop.rs:+22:17: +22:19 + StorageLive(_17); // scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 + _17 = (*_15); // scope 13 at $DIR/reference_prop.rs:+23:17: +23:19 +- _13 = const (); // scope 10 at $DIR/reference_prop.rs:+19:5: +24:6 + StorageDead(_17); // scope 13 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_16); // scope 12 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_15); // scope 11 at $DIR/reference_prop.rs:+24:5: +24:6 + StorageDead(_14); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 +- StorageDead(_13); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 +- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 + StorageLive(_19); // scope 15 at $DIR/reference_prop.rs:+28:13: +28:18 + _19 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+28:21: +28:28 + StorageLive(_20); // scope 16 at $DIR/reference_prop.rs:+29:13: +29:18 + _20 = &raw mut _19; // scope 16 at $DIR/reference_prop.rs:+29:21: +29:31 + StorageLive(_21); // scope 17 at $DIR/reference_prop.rs:+30:13: +30:14 + _21 = &mut _20; // scope 17 at $DIR/reference_prop.rs:+30:17: +30:23 + StorageLive(_22); // scope 18 at $DIR/reference_prop.rs:+31:13: +31:14 + _22 = (*_20); // scope 18 at $DIR/reference_prop.rs:+31:17: +31:19 +- _18 = const (); // scope 15 at $DIR/reference_prop.rs:+27:5: +32:6 + StorageDead(_22); // scope 18 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_21); // scope 17 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_20); // scope 16 at $DIR/reference_prop.rs:+32:5: +32:6 + StorageDead(_19); // scope 15 at $DIR/reference_prop.rs:+32:5: +32:6 +- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 +- StorageLive(_23); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 + StorageLive(_24); // scope 20 at $DIR/reference_prop.rs:+36:13: +36:18 + _24 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+36:21: +36:28 + StorageLive(_25); // scope 21 at $DIR/reference_prop.rs:+37:13: +37:14 + _25 = &raw mut _24; // scope 21 at $DIR/reference_prop.rs:+37:17: +37:27 + StorageLive(_26); // scope 22 at $DIR/reference_prop.rs:+38:13: +38:14 + _26 = (*_25); // scope 22 at $DIR/reference_prop.rs:+38:17: +38:19 + StorageLive(_27); // scope 23 at $DIR/reference_prop.rs:+39:9: +39:18 + StorageLive(_28); // scope 23 at $DIR/reference_prop.rs:+39:16: +39:17 + _28 = _25; // scope 23 at $DIR/reference_prop.rs:+39:16: +39:17 + _27 = opaque::<*mut usize>(move _28) -> bb1; // scope 23 at $DIR/reference_prop.rs:+39:9: +39:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:263:9: 263:15 + // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } + } + + bb1: { + StorageDead(_28); // scope 23 at $DIR/reference_prop.rs:+39:17: +39:18 + StorageDead(_27); // scope 23 at $DIR/reference_prop.rs:+39:18: +39:19 +- _23 = const (); // scope 20 at $DIR/reference_prop.rs:+35:5: +40:6 + StorageDead(_26); // scope 22 at $DIR/reference_prop.rs:+40:5: +40:6 + StorageDead(_25); // scope 21 at $DIR/reference_prop.rs:+40:5: +40:6 + StorageDead(_24); // scope 20 at $DIR/reference_prop.rs:+40:5: +40:6 +- StorageDead(_23); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 +- StorageLive(_29); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 + StorageLive(_30); // scope 24 at $DIR/reference_prop.rs:+44:13: +44:18 + _30 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+44:21: +44:28 + StorageLive(_31); // scope 25 at $DIR/reference_prop.rs:+45:13: +45:15 + _31 = &raw mut _30; // scope 25 at $DIR/reference_prop.rs:+45:18: +45:28 + StorageLive(_32); // scope 26 at $DIR/reference_prop.rs:+46:13: +46:14 + _32 = (*_31); // scope 26 at $DIR/reference_prop.rs:+46:17: +46:20 + StorageLive(_33); // scope 27 at $DIR/reference_prop.rs:+47:13: +47:15 + _33 = _31; // scope 27 at $DIR/reference_prop.rs:+47:18: +47:20 + StorageLive(_34); // scope 28 at $DIR/reference_prop.rs:+48:13: +48:15 + _34 = (*_33); // scope 28 at $DIR/reference_prop.rs:+48:18: +48:21 + StorageLive(_35); // scope 29 at $DIR/reference_prop.rs:+49:13: +49:15 + _35 = _33; // scope 29 at $DIR/reference_prop.rs:+49:18: +49:20 + StorageLive(_36); // scope 30 at $DIR/reference_prop.rs:+52:9: +52:19 + StorageLive(_37); // scope 30 at $DIR/reference_prop.rs:+52:16: +52:18 + _37 = _35; // scope 30 at $DIR/reference_prop.rs:+52:16: +52:18 + _36 = opaque::<*mut usize>(move _37) -> bb2; // scope 30 at $DIR/reference_prop.rs:+52:9: +52:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:276:9: 276:15 + // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } + } + + bb2: { + StorageDead(_37); // scope 30 at $DIR/reference_prop.rs:+52:18: +52:19 + StorageDead(_36); // scope 30 at $DIR/reference_prop.rs:+52:19: +52:20 +- _29 = const (); // scope 24 at $DIR/reference_prop.rs:+43:5: +53:6 + StorageDead(_35); // scope 29 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_34); // scope 28 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_33); // scope 27 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_32); // scope 26 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_31); // scope 25 at $DIR/reference_prop.rs:+53:5: +53:6 + StorageDead(_30); // scope 24 at $DIR/reference_prop.rs:+53:5: +53:6 +- StorageDead(_29); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 +- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 + StorageLive(_39); // scope 31 at $DIR/reference_prop.rs:+57:13: +57:14 + _39 = &raw mut (*_1); // scope 31 at $DIR/reference_prop.rs:+57:17: +57:33 + StorageLive(_40); // scope 32 at $DIR/reference_prop.rs:+58:13: +58:14 +- _40 = (*_39); // scope 32 at $DIR/reference_prop.rs:+58:17: +58:19 +- _38 = const (); // scope 31 at $DIR/reference_prop.rs:+56:5: +59:6 ++ _40 = (*_1); // scope 32 at $DIR/reference_prop.rs:+58:17: +58:19 + StorageDead(_40); // scope 32 at $DIR/reference_prop.rs:+59:5: +59:6 + StorageDead(_39); // scope 31 at $DIR/reference_prop.rs:+59:5: +59:6 +- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 + StorageLive(_41); // scope 34 at $DIR/reference_prop.rs:+63:13: +63:14 + _41 = &raw mut (*_2); // scope 34 at $DIR/reference_prop.rs:+63:17: +63:35 + StorageLive(_42); // scope 35 at $DIR/reference_prop.rs:+64:20: +64:36 + _42 = &raw mut (*_1); // scope 35 at $DIR/reference_prop.rs:+64:20: +64:36 + _2 = move _42; // scope 35 at $DIR/reference_prop.rs:+64:9: +64:36 + StorageDead(_42); // scope 35 at $DIR/reference_prop.rs:+64:35: +64:36 + StorageLive(_43); // scope 35 at $DIR/reference_prop.rs:+65:13: +65:14 + _43 = (*_41); // scope 35 at $DIR/reference_prop.rs:+65:17: +65:19 + _0 = const (); // scope 34 at $DIR/reference_prop.rs:+62:5: +66:6 + StorageDead(_43); // scope 35 at $DIR/reference_prop.rs:+66:5: +66:6 + StorageDead(_41); // scope 34 at $DIR/reference_prop.rs:+66:5: +66:6 + return; // scope 0 at $DIR/reference_prop.rs:+67:2: +67:2 + } + } + diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs new file mode 100644 index 000000000000..5625c20a420b --- /dev/null +++ b/tests/mir-opt/reference_prop.rs @@ -0,0 +1,428 @@ +// unit-test: ReferencePropagation + +#![feature(raw_ref_op)] +#![feature(core_intrinsics, custom_mir)] + +#[inline(never)] +fn opaque(_: impl Sized) {} + +fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { + // Propagation through a reference. + { + let a = 5_usize; + let b = &a; // This borrow is only used once. + let c = *b; // This should be optimized. + } + + // Propagation through a two references. + { + let a = 5_usize; + let a2 = 7_usize; + let mut b = &a; + b = &a2; + // `b` is assigned twice, so we cannot propagate it. + let c = *b; + } + + // Propagation through a borrowed reference. + { + let a = 5_usize; + let b = &a; + let d = &b; + let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + } + + // Propagation through a borrowed reference. + { + let a = 5_usize; + let mut b = &a; + let d = &mut b; + let c = *b; // `b` is mutably borrowed, we cannot know its value. + } + + // Propagation through an escaping borrow. + { + let a = 7_usize; + let b = &a; + let c = *b; + opaque(b); // `b` escapes here, so we can only replace immutable borrow + } + + // Propagation through a transitively escaping borrow. + { + let a = 7_usize; + let b1 = &a; + let c = *b1; + let b2 = b1; + let c2 = *b2; + let b3 = b2; + // `b3` escapes here, so we can only replace immutable borrow, + // for either `b`, `b2` or `b3`. + opaque(b3); + } + + // Propagation a reborrow of an argument. + { + let a = &*single; + let b = *a; // This should be optimized as `*single`. + } + + // Propagation a reborrow of a mutated argument. + { + let a = &*multiple; + multiple = &*single; + let b = *a; // This should not be optimized. + } +} + +fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a mut T) { + // Propagation through a reference. + { + let mut a = 5_usize; + let b = &mut a; // This borrow is only used once. + let c = *b; // This should be optimized. + } + + // Propagation through a two references. + { + let mut a = 5_usize; + let mut a2 = 7_usize; + let mut b = &mut a; + b = &mut a2; + // `b` is assigned twice, so we cannot propagate it. + let c = *b; + } + + // Propagation through a borrowed reference. + { + let mut a = 5_usize; + let b = &mut a; + let d = &b; + let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + } + + // Propagation through a borrowed reference. + { + let mut a = 5_usize; + let mut b = &mut a; + let d = &mut b; + let c = *b; // `b` is mutably borrowed, we cannot know its value. + } + + // Propagation through an escaping borrow. + { + let mut a = 7_usize; + let b = &mut a; + let c = *b; + opaque(b); // `b` escapes here, so we can only replace immutable borrow + } + + // Propagation through a transitively escaping borrow. + { + let mut a = 7_usize; + let b1 = &mut a; + let c = *b1; + let b2 = b1; + let c2 = *b2; + let b3 = b2; + // `b3` escapes here, so we can only replace immutable borrow, + // for either `b`, `b2` or `b3`. + opaque(b3); + } + + // Propagation a reborrow of an argument. + { + let a = &mut *single; + let b = *a; // This should be optimized as `*single`. + } + + // Propagation a reborrow of a mutated argument. + { + let a = &mut *multiple; + multiple = &mut *single; + let b = *a; // This should not be optimized. + } +} + +fn reference_propagation_const_ptr(single: *const T, mut multiple: *const T) { + // Propagation through a reference. + unsafe { + let a = 5_usize; + let b = &raw const a; // This borrow is only used once. + let c = *b; // This should be optimized. + } + + // Propagation through a two references. + unsafe { + let a = 5_usize; + let a2 = 7_usize; + let mut b = &raw const a; + b = &raw const a2; + // `b` is assigned twice, so we cannot propagate it. + let c = *b; + } + + // Propagation through a borrowed reference. + unsafe { + let a = 5_usize; + let b = &raw const a; + let d = &b; + let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + } + + // Propagation through a borrowed reference. + unsafe { + let a = 5_usize; + let mut b = &raw const a; + let d = &mut b; + let c = *b; // `b` is mutably borrowed, we cannot know its value. + } + + // Propagation through an escaping borrow. + unsafe { + let a = 7_usize; + let b = &raw const a; + let c = *b; + opaque(b); // `b` escapes here, so we can only replace immutable borrow + } + + // Propagation through a transitively escaping borrow. + unsafe { + let a = 7_usize; + let b1 = &raw const a; + let c = *b1; + let b2 = b1; + let c2 = *b2; + let b3 = b2; + // `b3` escapes here, so we can only replace immutable borrow, + // for either `b`, `b2` or `b3`. + opaque(b3); + } + + // Propagation a reborrow of an argument. + unsafe { + let a = &raw const *single; + let b = *a; // This should be optimized as `*single`. + } + + // Propagation a reborrow of a mutated argument. + unsafe { + let a = &raw const *multiple; + multiple = &raw const *single; + let b = *a; // This should not be optimized. + } + + // Propagation through a reborrow. + unsafe { + let a = 13_usize; + let b = &raw const a; + let c = &raw const *b; + let e = *c; + } +} + +fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) { + // Propagation through a reference. + unsafe { + let mut a = 5_usize; + let b = &raw mut a; // This borrow is only used once. + let c = *b; // This should be optimized. + } + + // Propagation through a two references. + unsafe { + let mut a = 5_usize; + let mut a2 = 7_usize; + let mut b = &raw mut a; + b = &raw mut a2; + // `b` is assigned twice, so we cannot propagate it. + let c = *b; + } + + // Propagation through a borrowed reference. + unsafe { + let mut a = 5_usize; + let b = &raw mut a; + let d = &b; + let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + } + + // Propagation through a borrowed reference. + unsafe { + let mut a = 5_usize; + let mut b = &raw mut a; + let d = &mut b; + let c = *b; // `b` is mutably borrowed, we cannot know its value. + } + + // Propagation through an escaping borrow. + unsafe { + let mut a = 7_usize; + let b = &raw mut a; + let c = *b; + opaque(b); // `b` escapes here, so we can only replace immutable borrow + } + + // Propagation through a transitively escaping borrow. + unsafe { + let mut a = 7_usize; + let b1 = &raw mut a; + let c = *b1; + let b2 = b1; + let c2 = *b2; + let b3 = b2; + // `b3` escapes here, so we can only replace immutable borrow, + // for either `b`, `b2` or `b3`. + opaque(b3); + } + + // Propagation a reborrow of an argument. + unsafe { + let a = &raw mut *single; + let b = *a; // This should be optimized as `*single`. + } + + // Propagation a reborrow of a mutated argument. + unsafe { + let a = &raw mut *multiple; + multiple = &raw mut *single; + let b = *a; // This should not be optimized. + } +} + +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +fn read_through_raw(x: &mut usize) -> usize { + use std::intrinsics::mir::*; + + mir!( + let r1: &mut usize; + let r2: &mut usize; + let p1: *mut usize; + let p2: *mut usize; + + { + r1 = &mut *x; + r2 = &mut *r1; + p1 = &raw mut *r1; + p2 = &raw mut *r2; + + RET = *p1; + RET = *p2; + Return() + } + ) +} + +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +fn multiple_storage() { + use std::intrinsics::mir::*; + + mir!( + let x: i32; + { + StorageLive(x); + x = 5; + let z = &x; + StorageDead(x); + StorageLive(x); + // As there are multiple `StorageLive` statements for `x`, we cannot know if this `z`'s + // pointer address is the address of `x`, so do nothing. + let y = *z; + Call(RET, retblock, opaque(y)) + } + + retblock = { + Return() + } + ) +} + +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +fn dominate_storage() { + use std::intrinsics::mir::*; + + mir!( + let x: i32; + let r: &i32; + let c: i32; + let d: bool; + { Goto(bb0) } + bb0 = { + x = 5; + r = &x; + Goto(bb1) + } + bb1 = { + let c = *r; + Call(RET, bb2, opaque(c)) + } + bb2 = { + StorageDead(x); + StorageLive(x); + let d = true; + match d { false => bb2, _ => bb0 } + } + ) +} + +#[custom_mir(dialect = "runtime", phase = "post-cleanup")] +fn maybe_dead(m: bool) { + use std::intrinsics::mir::*; + + mir!( + let x: i32; + let y: i32; + { + StorageLive(x); + StorageLive(y); + x = 5; + y = 5; + let a = &x; + let b = &mut y; + // As we don't replace `b` in `bb2`, we cannot replace it here either. + *b = 7; + match m { true => bb1, _ => bb2 } + } + bb1 = { + StorageDead(x); + StorageDead(y); + Goto(bb2) + } + bb2 = { + // As `x` may be `StorageDead`, `a` may be dangling, so we do nothing. + let z = *a; + Call(RET, bb3, opaque(z)) + } + bb3 = { + // As `y` may be `StorageDead`, `b` may be dangling, so we do nothing. + // This implies that we also do not substitute `b` in `bb0`. + let t = *b; + Call(RET, retblock, opaque(t)) + } + retblock = { + Return() + } + ) +} + +fn main() { + let mut x = 5_usize; + let mut y = 7_usize; + reference_propagation(&x, &y); + reference_propagation_mut(&mut x, &mut y); + reference_propagation_const_ptr(&raw const x, &raw const y); + reference_propagation_mut_ptr(&raw mut x, &raw mut y); + read_through_raw(&mut x); + multiple_storage(); + dominate_storage(); + maybe_dead(true); +} + +// EMIT_MIR reference_prop.reference_propagation.ReferencePropagation.diff +// EMIT_MIR reference_prop.reference_propagation_mut.ReferencePropagation.diff +// EMIT_MIR reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +// EMIT_MIR reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +// EMIT_MIR reference_prop.read_through_raw.ReferencePropagation.diff +// EMIT_MIR reference_prop.multiple_storage.ReferencePropagation.diff +// EMIT_MIR reference_prop.dominate_storage.ReferencePropagation.diff +// EMIT_MIR reference_prop.maybe_dead.ReferencePropagation.diff diff --git a/tests/mir-opt/slice_filter.rs b/tests/mir-opt/slice_filter.rs index 97c18af31de7..be32f40f1322 100644 --- a/tests/mir-opt/slice_filter.rs +++ b/tests/mir-opt/slice_filter.rs @@ -12,7 +12,9 @@ pub fn variant_b(input: &[(usize, usize, usize, usize)]) -> usize { input.iter().filter(|&&(a, b, c, d)| a <= c && d <= b || c <= a && b <= d).count() } +// EMIT_MIR slice_filter.variant_a-{closure#0}.ReferencePropagation.diff // EMIT_MIR slice_filter.variant_a-{closure#0}.CopyProp.diff // EMIT_MIR slice_filter.variant_a-{closure#0}.DestinationPropagation.diff // EMIT_MIR slice_filter.variant_b-{closure#0}.CopyProp.diff +// EMIT_MIR slice_filter.variant_b-{closure#0}.ReferencePropagation.diff // EMIT_MIR slice_filter.variant_b-{closure#0}.DestinationPropagation.diff diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff index 294c3272f4f1..a81553733a7d 100644 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff +++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff @@ -30,10 +30,14 @@ let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 scope 1 { - debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 - debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 - debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 - debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 +- debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 +- debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 +- debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 +- debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 ++ debug a => _20; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 ++ debug b => _15; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 ++ debug c => _11; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 ++ debug d => _24; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 scope 2 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:40: 8:46 debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL @@ -86,24 +90,29 @@ bb0: { _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 +- _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 ++ _20 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 +- _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 ++ _15 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 +- _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 ++ _11 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 +- _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 ++ _24 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + nop; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 - _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 - _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL - _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL +- StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- _29 = deref_copy _3; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 ++ _29 = deref_copy _20; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + _30 = deref_copy _11; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_31); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL _31 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL @@ -111,7 +120,8 @@ _8 = Le(move _31, move _32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_32); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_31); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 @@ -127,13 +137,14 @@ + nop; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 - _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 - _33 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL - _34 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL +- StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- _33 = deref_copy _5; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 ++ _33 = deref_copy _11; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + _34 = deref_copy _20; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL _35 = (*_33); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL @@ -141,7 +152,8 @@ _17 = Le(move _35, move _36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 @@ -166,13 +178,14 @@ - StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 + nop; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 - _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _37 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL - _38 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL +- StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- _37 = deref_copy _6; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 ++ _37 = deref_copy _24; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + _38 = deref_copy _15; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_39); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL _39 = (*_37); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL @@ -180,7 +193,8 @@ _12 = Le(move _39, move _40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_40); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_39); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 - _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 @@ -202,13 +216,14 @@ - StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 - _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _41 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL - _42 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL +- StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- _41 = deref_copy _4; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 ++ _41 = deref_copy _15; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + _42 = deref_copy _24; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL _43 = (*_41); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageLive(_44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL @@ -217,7 +232,8 @@ + _0 = Le(move _43, move _44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_44); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL StorageDead(_43); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL - StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 ++ nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff new file mode 100644 index 000000000000..18ea73059549 --- /dev/null +++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff @@ -0,0 +1,239 @@ +- // MIR for `variant_a::{closure#0}` before ReferencePropagation ++ // MIR for `variant_a::{closure#0}` after ReferencePropagation + + fn variant_a::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:8:25: 8:39], _2: &&(usize, usize, usize, usize)) -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:40: +0:40 + let _3: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + let _4: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + let _5: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + let _6: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:56 + let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:46 + let mut _9: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:40: +0:41 + let mut _10: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 + let _11: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:45: +0:46 + let mut _12: bool; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:56 + let mut _13: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:50: +0:51 + let mut _14: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 + let _15: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:55: +0:56 + let mut _16: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:76 + let mut _17: bool; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:66 + let mut _18: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:60: +0:61 + let mut _19: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 + let _20: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:65: +0:66 + let mut _21: bool; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:76 + let mut _22: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:70: +0:71 + let mut _23: &&usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + let _24: &usize; // in scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + let mut _25: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _26: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _27: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _28: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:38 + let mut _31: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _32: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _37: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _38: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _43: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _44: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _49: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _50: &usize; // in scope 0 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 1 { + debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:27: +0:28 + debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:30: +0:31 + debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:33: +0:34 + debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:36: +0:37 + scope 2 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:40: 8:46 + debug self => _9; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _10; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _29: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _30: &usize; // in scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 3 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _29; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _30; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _33: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _34: usize; // in scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 4 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:60: 8:66 + debug self => _18; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _19; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _35: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _36: &usize; // in scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 5 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _35; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _36; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _39: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _40: usize; // in scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 6 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:50: 8:56 + debug self => _13; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _14; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _41: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _42: &usize; // in scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 7 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _41; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _42; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _45: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _46: usize; // in scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + scope 8 (inlined cmp::impls::::le) { // at $DIR/slice_filter.rs:8:70: 8:76 + debug self => _22; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _23; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _47: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _48: &usize; // in scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + scope 9 (inlined cmp::impls::::le) { // at $SRC_DIR/core/src/cmp.rs:LL:COL + debug self => _47; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + debug other => _48; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _51: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + let mut _52: usize; // in scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + } + } + } + + bb0: { + _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:46 + StorageLive(_9); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 + _9 = &_3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:41 + StorageLive(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + _11 = _5; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + _10 = &_11; // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 +- _29 = deref_copy (*_9); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _30 = deref_copy (*_10); // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _29 = deref_copy _3; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _30 = deref_copy _11; // scope 2 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _33 = (*_29); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _34 = (*_30); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + _8 = Le(move _33, move _34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_34); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_33); // scope 3 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + StorageDead(_10); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + StorageDead(_9); // scope 1 at $DIR/slice_filter.rs:+0:45: +0:46 + switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + } + + bb1: { + _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + + bb2: { + StorageLive(_16); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + StorageLive(_17); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:66 + StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 + _18 = &_5; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:61 + StorageLive(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + StorageLive(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + _20 = _3; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + _19 = &_20; // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 +- _35 = deref_copy (*_18); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _36 = deref_copy (*_19); // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _35 = deref_copy _5; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _36 = deref_copy _20; // scope 4 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _39 = (*_35); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _40 = (*_36); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + _17 = Le(move _39, move _40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_40); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_39); // scope 5 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_20); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + StorageDead(_19); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:65: +0:66 + switchInt(move _17) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb3: { + StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 + } + + bb4: { + _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + } + + bb5: { + StorageLive(_12); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:56 + StorageLive(_13); // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 + _13 = &_6; // scope 1 at $DIR/slice_filter.rs:+0:50: +0:51 + StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _15 = _4; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _14 = &_15; // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 +- _41 = deref_copy (*_13); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _42 = deref_copy (*_14); // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _41 = deref_copy _6; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _42 = deref_copy _15; // scope 6 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _45 = (*_41); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _46 = (*_42); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + _12 = Le(move _45, move _46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_46); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_45); // scope 7 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_13); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + _7 = move _12; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 + StorageDead(_12); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:55: +0:56 + switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + + bb6: { + _16 = const false; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb7: { + StorageLive(_21); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:76 + StorageLive(_22); // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 + _22 = &_4; // scope 1 at $DIR/slice_filter.rs:+0:70: +0:71 + StorageLive(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageLive(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _24 = _6; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _23 = &_24; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- _47 = deref_copy (*_22); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL +- _48 = deref_copy (*_23); // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _47 = deref_copy _4; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL ++ _48 = deref_copy _24; // scope 8 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _51 = (*_47); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageLive(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _52 = (*_48); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + _21 = Le(move _51, move _52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_52); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_51); // scope 9 at $SRC_DIR/core/src/cmp.rs:LL:COL + StorageDead(_24); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_23); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_22); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _16 = move _21; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:60: +0:76 + } + + bb8: { + StorageDead(_21); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_17); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + _0 = move _16; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:40: +0:76 + } + } + diff --git a/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff new file mode 100644 index 000000000000..d1241c6b0245 --- /dev/null +++ b/tests/mir-opt/slice_filter.variant_b-{closure#0}.ReferencePropagation.diff @@ -0,0 +1,103 @@ +- // MIR for `variant_b::{closure#0}` before ReferencePropagation ++ // MIR for `variant_b::{closure#0}` after ReferencePropagation + + fn variant_b::{closure#0}(_1: &mut [closure@$DIR/slice_filter.rs:12:25: 12:41], _2: &&(usize, usize, usize, usize)) -> bool { + let mut _0: bool; // return place in scope 0 at $DIR/slice_filter.rs:+0:42: +0:42 + let _3: usize; // in scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + let _4: usize; // in scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + let _5: usize; // in scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + let _6: usize; // in scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + let mut _7: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:58 + let mut _8: bool; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:48 + let mut _9: usize; // in scope 0 at $DIR/slice_filter.rs:+0:42: +0:43 + let mut _10: usize; // in scope 0 at $DIR/slice_filter.rs:+0:47: +0:48 + let mut _11: bool; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:58 + let mut _12: usize; // in scope 0 at $DIR/slice_filter.rs:+0:52: +0:53 + let mut _13: usize; // in scope 0 at $DIR/slice_filter.rs:+0:57: +0:58 + let mut _14: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:78 + let mut _15: bool; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:68 + let mut _16: usize; // in scope 0 at $DIR/slice_filter.rs:+0:62: +0:63 + let mut _17: usize; // in scope 0 at $DIR/slice_filter.rs:+0:67: +0:68 + let mut _18: bool; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:78 + let mut _19: usize; // in scope 0 at $DIR/slice_filter.rs:+0:72: +0:73 + let mut _20: usize; // in scope 0 at $DIR/slice_filter.rs:+0:77: +0:78 + let mut _21: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let mut _22: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let mut _23: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + let mut _24: &(usize, usize, usize, usize); // in scope 0 at $DIR/slice_filter.rs:+0:26: +0:40 + scope 1 { + debug a => _3; // in scope 1 at $DIR/slice_filter.rs:+0:29: +0:30 + debug b => _4; // in scope 1 at $DIR/slice_filter.rs:+0:32: +0:33 + debug c => _5; // in scope 1 at $DIR/slice_filter.rs:+0:35: +0:36 + debug d => _6; // in scope 1 at $DIR/slice_filter.rs:+0:38: +0:39 + } + + bb0: { + _21 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + _3 = ((*_21).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:29: +0:30 + _22 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + _4 = ((*_22).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:32: +0:33 + _23 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + _5 = ((*_23).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:35: +0:36 + _24 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + _6 = ((*_24).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:38: +0:39 + StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageLive(_8); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 + _8 = Le(_3, _5); // scope 1 at $DIR/slice_filter.rs:+0:42: +0:48 + switchInt(move _8) -> [0: bb4, otherwise: bb5]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + } + + bb1: { + _0 = const true; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + + bb2: { + StorageLive(_14); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + StorageLive(_15); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 + _15 = Le(_5, _3); // scope 1 at $DIR/slice_filter.rs:+0:62: +0:68 + switchInt(move _15) -> [0: bb6, otherwise: bb7]; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb3: { + StorageDead(_14); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + return; // scope 0 at $DIR/slice_filter.rs:+0:78: +0:78 + } + + bb4: { + _7 = const false; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + goto -> bb2; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + } + + bb5: { + StorageLive(_11); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 + _11 = Le(_6, _4); // scope 1 at $DIR/slice_filter.rs:+0:52: +0:58 + _7 = move _11; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:58 + StorageDead(_11); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + StorageDead(_8); // scope 1 at $DIR/slice_filter.rs:+0:57: +0:58 + switchInt(move _7) -> [0: bb2, otherwise: bb1]; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + + bb6: { + _14 = const false; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb7: { + StorageLive(_18); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 + _18 = Le(_4, _6); // scope 1 at $DIR/slice_filter.rs:+0:72: +0:78 + _14 = move _18; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + goto -> bb8; // scope 1 at $DIR/slice_filter.rs:+0:62: +0:78 + } + + bb8: { + StorageDead(_18); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + StorageDead(_15); // scope 1 at $DIR/slice_filter.rs:+0:77: +0:78 + _0 = move _14; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + goto -> bb3; // scope 1 at $DIR/slice_filter.rs:+0:42: +0:78 + } + } + From 3c43b61b870add2daddbd8e480477e5a8aa409c2 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 26 Apr 2023 18:30:12 +0000 Subject: [PATCH 88/97] Do not consider borrowed Freeze locals as SSA. --- compiler/rustc_mir_transform/src/copy_prop.rs | 3 +- .../src/normalize_array_len.rs | 5 +- compiler/rustc_mir_transform/src/ref_prop.rs | 6 +-- compiler/rustc_mir_transform/src/ssa.rs | 49 ++++++++++++------- .../copy-prop/borrowed_local.f.CopyProp.diff | 3 +- ...ence_propagation.ReferencePropagation.diff | 3 +- ...gation_const_ptr.ReferencePropagation.diff | 3 +- ...filter.variant_a-{closure#0}.CopyProp.diff | 16 +++--- ..._a-{closure#0}.DestinationPropagation.diff | 16 ++++++ ...nt_a-{closure#0}.ReferencePropagation.diff | 8 +++ 10 files changed, 69 insertions(+), 43 deletions(-) diff --git a/compiler/rustc_mir_transform/src/copy_prop.rs b/compiler/rustc_mir_transform/src/copy_prop.rs index 2fa5c0bca15b..c565d6f13b17 100644 --- a/compiler/rustc_mir_transform/src/copy_prop.rs +++ b/compiler/rustc_mir_transform/src/copy_prop.rs @@ -33,9 +33,8 @@ impl<'tcx> MirPass<'tcx> for CopyProp { } fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); let borrowed_locals = borrowed_locals(body); - let ssa = SsaLocals::new(tcx, param_env, body, &borrowed_locals); + let ssa = SsaLocals::new(body); let fully_moved = fully_moved_locals(&ssa, body); debug!(?fully_moved); diff --git a/compiler/rustc_mir_transform/src/normalize_array_len.rs b/compiler/rustc_mir_transform/src/normalize_array_len.rs index 109a2c0aec6f..3d61d33ce353 100644 --- a/compiler/rustc_mir_transform/src/normalize_array_len.rs +++ b/compiler/rustc_mir_transform/src/normalize_array_len.rs @@ -7,7 +7,6 @@ use rustc_index::IndexVec; use rustc_middle::mir::visit::*; use rustc_middle::mir::*; use rustc_middle::ty::{self, TyCtxt}; -use rustc_mir_dataflow::impls::borrowed_locals; pub struct NormalizeArrayLen; @@ -24,9 +23,7 @@ impl<'tcx> MirPass<'tcx> for NormalizeArrayLen { } fn normalize_array_len_calls<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); - let borrowed_locals = borrowed_locals(body); - let ssa = SsaLocals::new(tcx, param_env, body, &borrowed_locals); + let ssa = SsaLocals::new(body); let slice_lengths = compute_slice_length(tcx, &ssa, body); debug!(?slice_lengths); diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs index dfdf4caf8811..a2e765100733 100644 --- a/compiler/rustc_mir_transform/src/ref_prop.rs +++ b/compiler/rustc_mir_transform/src/ref_prop.rs @@ -4,7 +4,7 @@ use rustc_index::IndexVec; use rustc_middle::mir::visit::*; use rustc_middle::mir::*; use rustc_middle::ty::TyCtxt; -use rustc_mir_dataflow::impls::{borrowed_locals, MaybeStorageDead}; +use rustc_mir_dataflow::impls::MaybeStorageDead; use rustc_mir_dataflow::storage::always_storage_live_locals; use rustc_mir_dataflow::Analysis; @@ -82,9 +82,7 @@ impl<'tcx> MirPass<'tcx> for ReferencePropagation { } fn propagate_ssa<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) { - let param_env = tcx.param_env_reveal_all_normalized(body.source.def_id()); - let borrowed_locals = borrowed_locals(body); - let ssa = SsaLocals::new(tcx, param_env, body, &borrowed_locals); + let ssa = SsaLocals::new(body); let mut replacer = compute_replacement(tcx, body, &ssa); debug!(?replacer.targets, ?replacer.allowed_replacements, ?replacer.storage_to_remove); diff --git a/compiler/rustc_mir_transform/src/ssa.rs b/compiler/rustc_mir_transform/src/ssa.rs index 270bb540b80d..d7fc6e2f6c30 100644 --- a/compiler/rustc_mir_transform/src/ssa.rs +++ b/compiler/rustc_mir_transform/src/ssa.rs @@ -1,3 +1,16 @@ +//! We denote as "SSA" the set of locals that verify the following properties: +//! 1/ They are only assigned-to once, either as a function parameter, or in an assign statement; +//! 2/ This single assignment dominates all uses; +//! +//! As a consequence of rule 2, we consider that borrowed locals are not SSA, even if they are +//! `Freeze`, as we do not track that the assignment dominates all uses of the borrow. +//! +//! We say a local has a stable address if its address has SSA-like properties: +//! 1/ It has a single `StorageLive` statement, or none at all (always-live); +//! 2/ All its uses dominate this `StorageLive` statement. +//! +//! We do not discard borrowed locals from this analysis, as we cannot take their address' address. + use either::Either; use rustc_data_structures::graph::dominators::Dominators; use rustc_index::bit_set::BitSet; @@ -5,7 +18,6 @@ use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::middle::resolve_bound_vars::Set1; use rustc_middle::mir::visit::*; use rustc_middle::mir::*; -use rustc_middle::ty::{ParamEnv, TyCtxt}; use rustc_mir_dataflow::storage::always_storage_live_locals; #[derive(Debug)] @@ -62,12 +74,7 @@ impl SmallDominators { } impl SsaLocals { - pub fn new<'tcx>( - tcx: TyCtxt<'tcx>, - param_env: ParamEnv<'tcx>, - body: &Body<'tcx>, - borrowed_locals: &BitSet, - ) -> SsaLocals { + pub fn new<'tcx>(body: &Body<'tcx>) -> SsaLocals { let assignment_order = Vec::with_capacity(body.local_decls.len()); let assignments = IndexVec::from_elem(Set1::Empty, &body.local_decls); @@ -80,13 +87,8 @@ impl SsaLocals { let mut visitor = SsaVisitor { assignments, assignment_order, dominators, direct_uses, storage_live }; - for (local, decl) in body.local_decls.iter_enumerated() { - if matches!(body.local_kind(local), LocalKind::Arg) { - visitor.assignments[local] = Set1::One(LocationExtended::Arg); - } - if borrowed_locals.contains(local) && !decl.ty.is_freeze(tcx, param_env) { - visitor.assignments[local] = Set1::Many; - } + for local in body.args_iter() { + visitor.assignments[local] = Set1::One(LocationExtended::Arg); } for local in always_storage_live_locals(body).iter() { @@ -237,6 +239,8 @@ struct SsaVisitor { impl<'tcx> Visitor<'tcx> for SsaVisitor { fn visit_local(&mut self, local: Local, ctxt: PlaceContext, loc: Location) { match ctxt { + PlaceContext::MutatingUse(MutatingUseContext::Projection) + | PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection) => bug!(), PlaceContext::MutatingUse(MutatingUseContext::Store) => { self.assignments[local].insert(LocationExtended::Plain(loc)); if let Set1::One(_) = self.assignments[local] { @@ -246,13 +250,18 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { self.dominators.check_dominates(&mut self.storage_live[local], loc); } // Anything can happen with raw pointers, so remove them. - PlaceContext::NonMutatingUse(NonMutatingUseContext::AddressOf) + // We do not verify that all uses of the borrow dominate the assignment to `local`, + // so we have to remove them too. + PlaceContext::NonMutatingUse( + NonMutatingUseContext::SharedBorrow + | NonMutatingUseContext::ShallowBorrow + | NonMutatingUseContext::UniqueBorrow + | NonMutatingUseContext::AddressOf, + ) | PlaceContext::MutatingUse(_) => { self.assignments[local] = Set1::Many; self.dominators.check_dominates(&mut self.storage_live[local], loc); } - // Immutable borrows are taken into account in `SsaLocals::new` by - // removing non-freeze locals. PlaceContext::NonMutatingUse(_) => { self.dominators.check_dominates(&mut self.assignments[local], loc); self.dominators.check_dominates(&mut self.storage_live[local], loc); @@ -270,15 +279,17 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { // Do not do anything for storage statements and debuginfo. if ctxt.is_use() { // Only change the context if it is a real use, not a "use" in debuginfo. - let new_ctxt = PlaceContext::NonMutatingUse(NonMutatingUseContext::Projection); + let new_ctxt = PlaceContext::NonMutatingUse(NonMutatingUseContext::Copy); self.visit_projection(place.as_ref(), new_ctxt, loc); self.dominators.check_dominates(&mut self.assignments[place.local], loc); self.dominators.check_dominates(&mut self.storage_live[place.local], loc); } return; + } else { + self.visit_projection(place.as_ref(), ctxt, loc); + self.visit_local(place.local, ctxt, loc); } - self.super_place(place, ctxt, loc); } } diff --git a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff index 2a0bff57db9c..51707e71661c 100644 --- a/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff +++ b/tests/mir-opt/copy-prop/borrowed_local.f.CopyProp.diff @@ -20,8 +20,7 @@ } bb1: { -- _0 = opaque::(_3) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38 -+ _0 = opaque::(_1) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38 + _0 = opaque::(_3) -> bb2; // scope 0 at $DIR/borrowed_local.rs:+12:13: +12:38 // mir::Constant // + span: $DIR/borrowed_local.rs:28:28: 28:34 // + literal: Const { ty: fn(u8) -> bool {opaque::}, val: Value() } diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index 12aea890e638..9a9d5d652346 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -178,9 +178,8 @@ StorageLive(_17); // scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 _17 = &_16; // scope 9 at $DIR/reference_prop.rs:+22:17: +22:19 StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 -- _18 = (*_16); // scope 10 at $DIR/reference_prop.rs:+23:17: +23:19 + _18 = (*_16); // scope 10 at $DIR/reference_prop.rs:+23:17: +23:19 - _14 = const (); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 -+ _18 = _15; // scope 10 at $DIR/reference_prop.rs:+23:17: +23:19 StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 StorageDead(_17); // scope 9 at $DIR/reference_prop.rs:+24:5: +24:6 StorageDead(_16); // scope 8 at $DIR/reference_prop.rs:+24:5: +24:6 diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index 2e6097af2c98..8edc8104f827 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -207,9 +207,8 @@ StorageLive(_16); // scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 _16 = &_15; // scope 12 at $DIR/reference_prop.rs:+22:17: +22:19 StorageLive(_17); // scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 -- _17 = (*_15); // scope 13 at $DIR/reference_prop.rs:+23:17: +23:19 + _17 = (*_15); // scope 13 at $DIR/reference_prop.rs:+23:17: +23:19 - _13 = const (); // scope 10 at $DIR/reference_prop.rs:+19:5: +24:6 -+ _17 = _14; // scope 13 at $DIR/reference_prop.rs:+23:17: +23:19 StorageDead(_17); // scope 13 at $DIR/reference_prop.rs:+24:5: +24:6 StorageDead(_16); // scope 12 at $DIR/reference_prop.rs:+24:5: +24:6 StorageDead(_15); // scope 11 at $DIR/reference_prop.rs:+24:5: +24:6 diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff index 3bb0358ffe3e..60e5056c7a92 100644 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff +++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.CopyProp.diff @@ -101,16 +101,16 @@ } bb0: { -- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 -- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 -- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 -- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 @@ -184,10 +184,10 @@ bb3: { StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 -- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 } diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff index a81553733a7d..7ad1ccf28a60 100644 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff +++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.DestinationPropagation.diff @@ -89,15 +89,23 @@ } bb0: { +- StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 ++ nop; // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 - _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 +- StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + _20 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 ++ nop; // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 - _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 +- StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + _15 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 ++ nop; // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 - _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 +- StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 + _11 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 ++ nop; // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 - StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 @@ -162,8 +170,16 @@ bb3: { - StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 - StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 +- StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + nop; // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 ++ nop; // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 ++ nop; // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 ++ nop; // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 ++ nop; // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 } diff --git a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff index 18ea73059549..f6350b3812a2 100644 --- a/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff +++ b/tests/mir-opt/slice_filter.variant_a-{closure#0}.ReferencePropagation.diff @@ -93,12 +93,16 @@ } bb0: { + StorageLive(_3); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 _25 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 _3 = &((*_25).0: usize); // scope 0 at $DIR/slice_filter.rs:+0:27: +0:28 + StorageLive(_4); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 _26 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 _4 = &((*_26).1: usize); // scope 0 at $DIR/slice_filter.rs:+0:30: +0:31 + StorageLive(_5); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 _27 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 _5 = &((*_27).2: usize); // scope 0 at $DIR/slice_filter.rs:+0:33: +0:34 + StorageLive(_6); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _28 = deref_copy (*_2); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 _6 = &((*_28).3: usize); // scope 0 at $DIR/slice_filter.rs:+0:36: +0:37 StorageLive(_7); // scope 1 at $DIR/slice_filter.rs:+0:40: +0:56 @@ -160,6 +164,10 @@ bb3: { StorageDead(_16); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 StorageDead(_7); // scope 1 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_6); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_5); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_4); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 + StorageDead(_3); // scope 0 at $DIR/slice_filter.rs:+0:75: +0:76 return; // scope 0 at $DIR/slice_filter.rs:+0:76: +0:76 } From 38612f5ec7a464709f2dabde4edb843695ec84b2 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 26 Apr 2023 18:40:10 +0000 Subject: [PATCH 89/97] Explicitly skip arguments. --- compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs index 9656148581f8..463ce083a64f 100644 --- a/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs +++ b/compiler/rustc_mir_dataflow/src/impls/storage_liveness.rs @@ -97,6 +97,7 @@ impl<'tcx> crate::AnalysisDomain<'tcx> for MaybeStorageDead { fn initialize_start_block(&self, body: &mir::Body<'tcx>, on_entry: &mut Self::Domain) { assert_eq!(body.local_decls.len(), self.always_live_locals.domain_size()); + // Do not iterate on return place and args, as they are trivially always live. for local in body.vars_and_temps_iter() { if !self.always_live_locals.contains(local) { on_entry.insert(local); From 0bd9bd6b8acfcd102bbc31ac407f1883480accbc Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Wed, 26 Apr 2023 18:42:41 +0000 Subject: [PATCH 90/97] Explicit performance concern. --- compiler/rustc_mir_transform/src/ref_prop.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs index a2e765100733..bdb008efe1e8 100644 --- a/compiler/rustc_mir_transform/src/ref_prop.rs +++ b/compiler/rustc_mir_transform/src/ref_prop.rs @@ -131,8 +131,8 @@ fn compute_replacement<'tcx>( let maybe_dead = maybe_dead.contains(target.local); if target.projection.first() == Some(&PlaceElem::Deref) { - // We are creating a reborrow. As `place.local` is a reference, removing the - // `StorageDead` is fine. + // We are creating a reborrow. As `place.local` is a reference, removing the storage + // statements should not make it much harder for LLVM to optimize. if maybe_dead { storage_to_remove.insert(target.local); } From 3268f2e61dcf2132570f5e36147a67bc25355a40 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 30 Apr 2023 09:55:24 +0000 Subject: [PATCH 91/97] Only check that StorageLive dominates address-taking. --- compiler/rustc_mir_transform/src/ssa.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/compiler/rustc_mir_transform/src/ssa.rs b/compiler/rustc_mir_transform/src/ssa.rs index d7fc6e2f6c30..fe2e79a4fc1f 100644 --- a/compiler/rustc_mir_transform/src/ssa.rs +++ b/compiler/rustc_mir_transform/src/ssa.rs @@ -7,7 +7,7 @@ //! //! We say a local has a stable address if its address has SSA-like properties: //! 1/ It has a single `StorageLive` statement, or none at all (always-live); -//! 2/ All its uses dominate this `StorageLive` statement. +//! 2/ This `StorageLive` statement dominates all statements that take this local's address. //! //! We do not discard borrowed locals from this analysis, as we cannot take their address' address. @@ -247,7 +247,6 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { // Only record if SSA-like, to avoid growing the vector needlessly. self.assignment_order.push(local); } - self.dominators.check_dominates(&mut self.storage_live[local], loc); } // Anything can happen with raw pointers, so remove them. // We do not verify that all uses of the borrow dominate the assignment to `local`, @@ -264,7 +263,6 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { } PlaceContext::NonMutatingUse(_) => { self.dominators.check_dominates(&mut self.assignments[local], loc); - self.dominators.check_dominates(&mut self.storage_live[local], loc); self.direct_uses[local] += 1; } PlaceContext::NonUse(NonUseContext::StorageLive) => { @@ -283,7 +281,6 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { self.visit_projection(place.as_ref(), new_ctxt, loc); self.dominators.check_dominates(&mut self.assignments[place.local], loc); - self.dominators.check_dominates(&mut self.storage_live[place.local], loc); } return; } else { From 3b4e1fe10460db3c6fe26947a9b8c7ac039540f6 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Fri, 5 May 2023 15:36:01 +0000 Subject: [PATCH 92/97] Do not check StorageLive dominates address-taking. --- compiler/rustc_mir_transform/src/ref_prop.rs | 44 ++++++++++-- compiler/rustc_mir_transform/src/ssa.rs | 72 ++++++++++---------- 2 files changed, 75 insertions(+), 41 deletions(-) diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs index bdb008efe1e8..9afbae9d8d11 100644 --- a/compiler/rustc_mir_transform/src/ref_prop.rs +++ b/compiler/rustc_mir_transform/src/ref_prop.rs @@ -8,7 +8,7 @@ use rustc_mir_dataflow::impls::MaybeStorageDead; use rustc_mir_dataflow::storage::always_storage_live_locals; use rustc_mir_dataflow::Analysis; -use crate::ssa::SsaLocals; +use crate::ssa::{SsaLocals, StorageLiveLocals}; use crate::MirPass; /// Propagate references using SSA analysis. @@ -39,7 +39,7 @@ use crate::MirPass; /// - all projections in `PROJECTIONS` have a stable offset (no dereference and no indexing). /// /// If `PLACE` is a direct projection of a local, we consider it as constant if: -/// - the local is always live, or it has a single `StorageLive` that dominates all uses; +/// - the local is always live, or it has a single `StorageLive`; /// - all projections have a stable offset. /// /// # Liveness @@ -110,9 +110,13 @@ fn compute_replacement<'tcx>( body: &Body<'tcx>, ssa: &SsaLocals, ) -> Replacer<'tcx> { + let always_live_locals = always_storage_live_locals(body); + + // Compute which locals have a single `StorageLive` statement ever. + let storage_live = StorageLiveLocals::new(body, &always_live_locals); + // Compute `MaybeStorageDead` dataflow to check that we only replace when the pointee is // definitely live. - let always_live_locals = always_storage_live_locals(body); let mut maybe_dead = MaybeStorageDead::new(always_live_locals) .into_engine(tcx, body) .iterate_to_fixpoint() @@ -126,6 +130,38 @@ fn compute_replacement<'tcx>( let fully_replacable_locals = fully_replacable_locals(ssa); + // Returns true iff we can use `place` as a pointee. + // + // Note that we only need to verify that there is a single `StorageLive` statement, and we do + // not need to verify that it dominates all uses of that local. + // + // Consider the three statements: + // SL : StorageLive(a) + // DEF: b = &raw? mut? a + // USE: stuff that uses *b + // + // First, we recall that DEF is checked to dominate USE. Now imagine for the sake of + // contradiction there is a DEF -> SL -> USE path. Consider two cases: + // + // - DEF dominates SL. We always have UB the first time control flow reaches DEF, + // because the storage of `a` is dead. Since DEF dominates USE, that means we cannot + // reach USE and so our optimization is ok. + // + // - DEF does not dominate SL. Then there is a `START_BLOCK -> SL` path not including DEF. + // But we can extend this path to USE, meaning there is also a `START_BLOCK -> USE` path not + // including DEF. This violates the DEF dominates USE condition, and so is impossible. + let is_constant_place = |place: Place<'_>| { + // We only allow `Deref` as the first projection, to avoid surprises. + if place.projection.first() == Some(&PlaceElem::Deref) { + // `place == (*some_local).xxx`, it is constant only if `some_local` is constant. + // We approximate constness using SSAness. + ssa.is_ssa(place.local) && place.projection[1..].iter().all(PlaceElem::is_stable_offset) + } else { + storage_live.has_single_storage(place.local) + && place.projection[..].iter().all(PlaceElem::is_stable_offset) + } + }; + let mut can_perform_opt = |target: Place<'tcx>, loc: Location| { maybe_dead.seek_after_primary_effect(loc); let maybe_dead = maybe_dead.contains(target.local); @@ -194,7 +230,7 @@ fn compute_replacement<'tcx>( place = target.project_deeper(&place.projection[1..], tcx); } assert_ne!(place.local, local); - if ssa.is_constant_place(place) { + if is_constant_place(place) { targets[local] = Value::Pointer(place, ty.is_mutable_ptr()); } } diff --git a/compiler/rustc_mir_transform/src/ssa.rs b/compiler/rustc_mir_transform/src/ssa.rs index fe2e79a4fc1f..5633adf673e9 100644 --- a/compiler/rustc_mir_transform/src/ssa.rs +++ b/compiler/rustc_mir_transform/src/ssa.rs @@ -4,12 +4,6 @@ //! //! As a consequence of rule 2, we consider that borrowed locals are not SSA, even if they are //! `Freeze`, as we do not track that the assignment dominates all uses of the borrow. -//! -//! We say a local has a stable address if its address has SSA-like properties: -//! 1/ It has a single `StorageLive` statement, or none at all (always-live); -//! 2/ This `StorageLive` statement dominates all statements that take this local's address. -//! -//! We do not discard borrowed locals from this analysis, as we cannot take their address' address. use either::Either; use rustc_data_structures::graph::dominators::Dominators; @@ -18,7 +12,6 @@ use rustc_index::{IndexSlice, IndexVec}; use rustc_middle::middle::resolve_bound_vars::Set1; use rustc_middle::mir::visit::*; use rustc_middle::mir::*; -use rustc_mir_dataflow::storage::always_storage_live_locals; #[derive(Debug)] pub struct SsaLocals { @@ -33,9 +26,6 @@ pub struct SsaLocals { /// Number of "direct" uses of each local, ie. uses that are not dereferences. /// We ignore non-uses (Storage statements, debuginfo). direct_uses: IndexVec, - /// Set of "StorageLive" statements for each local. When the "StorageLive" statement does not - /// dominate all uses of the local, we mark it as `Set1::Many`. - storage_live: IndexVec>, } /// We often encounter MIR bodies with 1 or 2 basic blocks. In those cases, it's unnecessary to @@ -83,18 +73,12 @@ impl SsaLocals { let dominators = SmallDominators { inner: dominators }; let direct_uses = IndexVec::from_elem(0, &body.local_decls); - let storage_live = IndexVec::from_elem(Set1::Empty, &body.local_decls); - let mut visitor = - SsaVisitor { assignments, assignment_order, dominators, direct_uses, storage_live }; + let mut visitor = SsaVisitor { assignments, assignment_order, dominators, direct_uses }; for local in body.args_iter() { visitor.assignments[local] = Set1::One(LocationExtended::Arg); } - for local in always_storage_live_locals(body).iter() { - visitor.storage_live[local] = Set1::One(LocationExtended::Arg); - } - if body.basic_blocks.len() > 2 { for (bb, data) in traversal::reverse_postorder(body) { visitor.visit_basic_block_data(bb, data); @@ -111,7 +95,6 @@ impl SsaLocals { debug!(?visitor.assignments); debug!(?visitor.direct_uses); - debug!(?visitor.storage_live); visitor .assignment_order @@ -124,7 +107,6 @@ impl SsaLocals { assignments: visitor.assignments, assignment_order: visitor.assignment_order, direct_uses: visitor.direct_uses, - storage_live: visitor.storage_live, copy_classes, } } @@ -141,19 +123,6 @@ impl SsaLocals { matches!(self.assignments[local], Set1::One(_)) } - /// Returns true iff we can use `p` as a pointee. - pub fn is_constant_place(&self, p: Place<'_>) -> bool { - // We only allow `Deref` as the first projection, to avoid surprises. - if p.projection.first() == Some(&PlaceElem::Deref) { - // `p == (*some_local).xxx`, it is constant only if `some_local` is constant. - // We approximate constness using SSAness. - self.is_ssa(p.local) && p.projection[1..].iter().all(PlaceElem::is_stable_offset) - } else { - matches!(self.storage_live[p.local], Set1::One(_)) - && p.projection[..].iter().all(PlaceElem::is_stable_offset) - } - } - /// Return the number of uses if a local that are not "Deref". pub fn num_direct_uses(&self, local: Local) -> u32 { self.direct_uses[local] @@ -233,7 +202,6 @@ struct SsaVisitor { assignments: IndexVec>, assignment_order: Vec, direct_uses: IndexVec, - storage_live: IndexVec>, } impl<'tcx> Visitor<'tcx> for SsaVisitor { @@ -259,15 +227,11 @@ impl<'tcx> Visitor<'tcx> for SsaVisitor { ) | PlaceContext::MutatingUse(_) => { self.assignments[local] = Set1::Many; - self.dominators.check_dominates(&mut self.storage_live[local], loc); } PlaceContext::NonMutatingUse(_) => { self.dominators.check_dominates(&mut self.assignments[local], loc); self.direct_uses[local] += 1; } - PlaceContext::NonUse(NonUseContext::StorageLive) => { - self.storage_live[local].insert(LocationExtended::Plain(loc)); - } PlaceContext::NonUse(_) => {} } } @@ -335,3 +299,37 @@ fn compute_copy_classes(ssa: &mut SsaVisitor, body: &Body<'_>) -> IndexVec>, +} + +impl StorageLiveLocals { + pub(crate) fn new( + body: &Body<'_>, + always_storage_live_locals: &BitSet, + ) -> StorageLiveLocals { + let mut storage_live = IndexVec::from_elem(Set1::Empty, &body.local_decls); + for local in always_storage_live_locals.iter() { + storage_live[local] = Set1::One(LocationExtended::Arg); + } + for (block, bbdata) in body.basic_blocks.iter_enumerated() { + for (statement_index, statement) in bbdata.statements.iter().enumerate() { + if let StatementKind::StorageLive(local) = statement.kind { + storage_live[local] + .insert(LocationExtended::Plain(Location { block, statement_index })); + } + } + } + debug!(?storage_live); + StorageLiveLocals { storage_live } + } + + #[inline] + pub(crate) fn has_single_storage(&self, local: Local) -> bool { + matches!(self.storage_live[local], Set1::One(_)) + } +} From a67bf08ed79936fdf9b06d2c8d22fbeb60e55505 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 7 May 2023 12:09:06 +0000 Subject: [PATCH 93/97] Only check storage liveness for direct projections. --- compiler/rustc_mir_transform/src/ref_prop.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/rustc_mir_transform/src/ref_prop.rs b/compiler/rustc_mir_transform/src/ref_prop.rs index 9afbae9d8d11..dafd2ae23a63 100644 --- a/compiler/rustc_mir_transform/src/ref_prop.rs +++ b/compiler/rustc_mir_transform/src/ref_prop.rs @@ -163,18 +163,15 @@ fn compute_replacement<'tcx>( }; let mut can_perform_opt = |target: Place<'tcx>, loc: Location| { - maybe_dead.seek_after_primary_effect(loc); - let maybe_dead = maybe_dead.contains(target.local); - if target.projection.first() == Some(&PlaceElem::Deref) { // We are creating a reborrow. As `place.local` is a reference, removing the storage // statements should not make it much harder for LLVM to optimize. - if maybe_dead { - storage_to_remove.insert(target.local); - } + storage_to_remove.insert(target.local); true } else { // This is a proper dereference. We can only allow it if `target` is live. + maybe_dead.seek_after_primary_effect(loc); + let maybe_dead = maybe_dead.contains(target.local); !maybe_dead } }; From c17e878fb86bd65b1148e7b08cbb465d396596a2 Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 7 May 2023 12:12:31 +0000 Subject: [PATCH 94/97] Correct StorageLive comment. --- compiler/rustc_mir_transform/src/ssa.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compiler/rustc_mir_transform/src/ssa.rs b/compiler/rustc_mir_transform/src/ssa.rs index 5633adf673e9..05a7b226f0c2 100644 --- a/compiler/rustc_mir_transform/src/ssa.rs +++ b/compiler/rustc_mir_transform/src/ssa.rs @@ -302,8 +302,7 @@ fn compute_copy_classes(ssa: &mut SsaVisitor, body: &Body<'_>) -> IndexVec>, } From 8e5910fdf26cf0db4c0002954c10500c6fcac41b Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Sun, 7 May 2023 12:19:46 +0000 Subject: [PATCH 95/97] Separate test cases into bbs. --- ...dominate_storage.ReferencePropagation.diff | 2 +- ..._prop.maybe_dead.ReferencePropagation.diff | 28 +- ...multiple_storage.ReferencePropagation.diff | 2 +- ...ence_propagation.ReferencePropagation.diff | 488 +++++++++------- ...gation_const_ptr.ReferencePropagation.diff | 534 +++++++++++------- ..._propagation_mut.ReferencePropagation.diff | 482 +++++++++------- ...pagation_mut_ptr.ReferencePropagation.diff | 462 ++++++++------- tests/mir-opt/reference_prop.rs | 33 +- 8 files changed, 1207 insertions(+), 824 deletions(-) diff --git a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff index 7e79e15ccdab..c8488400f905 100644 --- a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff @@ -24,7 +24,7 @@ _5 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL _0 = opaque::(_5) -> bb3; // scope 0 at $DIR/reference_prop.rs:+16:13: +16:38 // mir::Constant - // + span: $DIR/reference_prop.rs:357:28: 357:34 + // + span: $DIR/reference_prop.rs:382:28: 382:34 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff index 9dac0b333b81..50b2e152afdb 100644 --- a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff @@ -9,6 +9,7 @@ let mut _5: &mut i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL let mut _6: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL let mut _7: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + let mut _8: i32; // in scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL bb0: { StorageLive(_2); // scope 0 at $DIR/reference_prop.rs:+7:13: +7:27 @@ -18,33 +19,38 @@ _4 = &_2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL _5 = &mut _3; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL (*_5) = const 7_i32; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:19 - switchInt(_1) -> [1: bb1, otherwise: bb2]; // scope 0 at $DIR/reference_prop.rs:+15:13: +15:46 +- _6 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL ++ _6 = _2; // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + switchInt(_1) -> [1: bb1, otherwise: bb2]; // scope 0 at $DIR/reference_prop.rs:+17:13: +17:46 } bb1: { - StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+18:13: +18:27 - StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+19:13: +19:27 - goto -> bb2; // scope 0 at $DIR/reference_prop.rs:+20:13: +20:22 + StorageDead(_2); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:27 + StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+21:13: +21:27 + _0 = opaque::(_6) -> bb2; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:38 + // mir::Constant + // + span: $DIR/reference_prop.rs:416:28: 416:34 + // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } bb2: { - _6 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - _0 = opaque::(_6) -> bb3; // scope 0 at $DIR/reference_prop.rs:+25:13: +25:38 + _7 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_7) -> bb3; // scope 0 at $DIR/reference_prop.rs:+27:13: +27:38 // mir::Constant - // + span: $DIR/reference_prop.rs:394:28: 394:34 + // + span: $DIR/reference_prop.rs:421:28: 421:34 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } bb3: { - _7 = (*_5); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL - _0 = opaque::(_7) -> bb4; // scope 0 at $DIR/reference_prop.rs:+31:13: +31:43 + _8 = (*_5); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL + _0 = opaque::(_8) -> bb4; // scope 0 at $DIR/reference_prop.rs:+33:13: +33:43 // mir::Constant - // + span: $DIR/reference_prop.rs:400:33: 400:39 + // + span: $DIR/reference_prop.rs:427:33: 427:39 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } bb4: { - return; // scope 0 at $DIR/reference_prop.rs:+34:13: +34:21 + return; // scope 0 at $DIR/reference_prop.rs:+36:13: +36:21 } } diff --git a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff index 994791072e11..08de44659e98 100644 --- a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff @@ -16,7 +16,7 @@ _3 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL _0 = opaque::(_3) -> bb1; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:43 // mir::Constant - // + span: $DIR/reference_prop.rs:331:33: 331:39 + // + span: $DIR/reference_prop.rs:356:33: 356:39 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index 9a9d5d652346..04f5cc9d41f5 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -5,29 +5,41 @@ debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:39: +0:45 debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:54: +0:66 let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:75: +0:75 - let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 let _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:14 - let _7: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - let _8: usize; // in scope 0 at $DIR/reference_prop.rs:+10:13: +10:14 - let mut _11: &usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:16 - let _12: &usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:16 - let _14: (); // in scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - let _15: usize; // in scope 0 at $DIR/reference_prop.rs:+20:13: +20:14 - let _19: (); // in scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - let _20: usize; // in scope 0 at $DIR/reference_prop.rs:+28:13: +28:14 - let _24: (); // in scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - let _25: usize; // in scope 0 at $DIR/reference_prop.rs:+36:13: +36:14 - let _28: (); // in scope 0 at $DIR/reference_prop.rs:+39:9: +39:18 - let mut _29: &usize; // in scope 0 at $DIR/reference_prop.rs:+39:16: +39:17 - let _30: (); // in scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - let _31: usize; // in scope 0 at $DIR/reference_prop.rs:+44:13: +44:14 - let _37: (); // in scope 0 at $DIR/reference_prop.rs:+52:9: +52:19 - let mut _38: &usize; // in scope 0 at $DIR/reference_prop.rs:+52:16: +52:18 - let _39: (); // in scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 - let _40: &T; // in scope 0 at $DIR/reference_prop.rs:+57:13: +57:14 - let _42: &T; // in scope 0 at $DIR/reference_prop.rs:+63:13: +63:14 - let mut _43: &T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:28 - let _44: &T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:28 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19 + let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18 + let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + let _10: usize; // in scope 0 at $DIR/reference_prop.rs:+11:13: +11:14 + let mut _13: &usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:16 + let _14: &usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:16 + let _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19 + let mut _17: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18 + let _18: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + let _19: usize; // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:14 + let _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:19 + let mut _24: (); // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:18 + let _25: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + let _26: usize; // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:14 + let _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:19 + let mut _31: (); // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:18 + let _32: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + let _33: usize; // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:14 + let _36: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18 + let mut _37: &usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17 + let _38: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + let _39: usize; // in scope 0 at $DIR/reference_prop.rs:+48:13: +48:14 + let _45: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19 + let mut _46: &usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18 + let _47: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + let _48: &T; // in scope 0 at $DIR/reference_prop.rs:+61:13: +61:14 + let _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19 + let mut _51: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18 + let _52: &T; // in scope 0 at $DIR/reference_prop.rs:+68:13: +68:14 + let mut _53: &T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:28 + let _54: &T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:28 + let _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19 + let mut _57: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18 scope 1 { debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 let _5: &usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 @@ -40,78 +52,78 @@ } } scope 4 { - debug a => _8; // in scope 4 at $DIR/reference_prop.rs:+10:13: +10:14 - let _9: usize; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:15 + debug a => _10; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:14 + let _11: usize; // in scope 4 at $DIR/reference_prop.rs:+12:13: +12:15 scope 5 { - debug a2 => _9; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:15 - let mut _10: &usize; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:18 + debug a2 => _11; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:15 + let mut _12: &usize; // in scope 5 at $DIR/reference_prop.rs:+13:13: +13:18 scope 6 { - debug b => _10; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:18 - let _13: usize; // in scope 6 at $DIR/reference_prop.rs:+15:13: +15:14 + debug b => _12; // in scope 6 at $DIR/reference_prop.rs:+13:13: +13:18 + let _15: usize; // in scope 6 at $DIR/reference_prop.rs:+16:13: +16:14 scope 7 { - debug c => _13; // in scope 7 at $DIR/reference_prop.rs:+15:13: +15:14 + debug c => _15; // in scope 7 at $DIR/reference_prop.rs:+16:13: +16:14 } } } } scope 8 { - debug a => _15; // in scope 8 at $DIR/reference_prop.rs:+20:13: +20:14 - let _16: &usize; // in scope 8 at $DIR/reference_prop.rs:+21:13: +21:14 + debug a => _19; // in scope 8 at $DIR/reference_prop.rs:+22:13: +22:14 + let _20: &usize; // in scope 8 at $DIR/reference_prop.rs:+23:13: +23:14 scope 9 { - debug b => _16; // in scope 9 at $DIR/reference_prop.rs:+21:13: +21:14 - let _17: &&usize; // in scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 + debug b => _20; // in scope 9 at $DIR/reference_prop.rs:+23:13: +23:14 + let _21: &&usize; // in scope 9 at $DIR/reference_prop.rs:+24:13: +24:14 scope 10 { - debug d => _17; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:14 - let _18: usize; // in scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 + debug d => _21; // in scope 10 at $DIR/reference_prop.rs:+24:13: +24:14 + let _22: usize; // in scope 10 at $DIR/reference_prop.rs:+25:13: +25:14 scope 11 { - debug c => _18; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + debug c => _22; // in scope 11 at $DIR/reference_prop.rs:+25:13: +25:14 } } } } scope 12 { - debug a => _20; // in scope 12 at $DIR/reference_prop.rs:+28:13: +28:14 - let mut _21: &usize; // in scope 12 at $DIR/reference_prop.rs:+29:13: +29:18 + debug a => _26; // in scope 12 at $DIR/reference_prop.rs:+31:13: +31:14 + let mut _27: &usize; // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18 scope 13 { - debug b => _21; // in scope 13 at $DIR/reference_prop.rs:+29:13: +29:18 - let _22: &mut &usize; // in scope 13 at $DIR/reference_prop.rs:+30:13: +30:14 + debug b => _27; // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18 + let _28: &mut &usize; // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14 scope 14 { - debug d => _22; // in scope 14 at $DIR/reference_prop.rs:+30:13: +30:14 - let _23: usize; // in scope 14 at $DIR/reference_prop.rs:+31:13: +31:14 + debug d => _28; // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14 + let _29: usize; // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14 scope 15 { - debug c => _23; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:14 + debug c => _29; // in scope 15 at $DIR/reference_prop.rs:+34:13: +34:14 } } } } scope 16 { - debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+36:13: +36:14 - let _26: &usize; // in scope 16 at $DIR/reference_prop.rs:+37:13: +37:14 + debug a => _33; // in scope 16 at $DIR/reference_prop.rs:+40:13: +40:14 + let _34: &usize; // in scope 16 at $DIR/reference_prop.rs:+41:13: +41:14 scope 17 { - debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+37:13: +37:14 - let _27: usize; // in scope 17 at $DIR/reference_prop.rs:+38:13: +38:14 + debug b => _34; // in scope 17 at $DIR/reference_prop.rs:+41:13: +41:14 + let _35: usize; // in scope 17 at $DIR/reference_prop.rs:+42:13: +42:14 scope 18 { - debug c => _27; // in scope 18 at $DIR/reference_prop.rs:+38:13: +38:14 + debug c => _35; // in scope 18 at $DIR/reference_prop.rs:+42:13: +42:14 } } } scope 19 { - debug a => _31; // in scope 19 at $DIR/reference_prop.rs:+44:13: +44:14 - let _32: &usize; // in scope 19 at $DIR/reference_prop.rs:+45:13: +45:15 + debug a => _39; // in scope 19 at $DIR/reference_prop.rs:+48:13: +48:14 + let _40: &usize; // in scope 19 at $DIR/reference_prop.rs:+49:13: +49:15 scope 20 { - debug b1 => _32; // in scope 20 at $DIR/reference_prop.rs:+45:13: +45:15 - let _33: usize; // in scope 20 at $DIR/reference_prop.rs:+46:13: +46:14 + debug b1 => _40; // in scope 20 at $DIR/reference_prop.rs:+49:13: +49:15 + let _41: usize; // in scope 20 at $DIR/reference_prop.rs:+50:13: +50:14 scope 21 { - debug c => _33; // in scope 21 at $DIR/reference_prop.rs:+46:13: +46:14 - let _34: &usize; // in scope 21 at $DIR/reference_prop.rs:+47:13: +47:15 + debug c => _41; // in scope 21 at $DIR/reference_prop.rs:+50:13: +50:14 + let _42: &usize; // in scope 21 at $DIR/reference_prop.rs:+51:13: +51:15 scope 22 { - debug b2 => _34; // in scope 22 at $DIR/reference_prop.rs:+47:13: +47:15 - let _35: usize; // in scope 22 at $DIR/reference_prop.rs:+48:13: +48:15 + debug b2 => _42; // in scope 22 at $DIR/reference_prop.rs:+51:13: +51:15 + let _43: usize; // in scope 22 at $DIR/reference_prop.rs:+52:13: +52:15 scope 23 { - debug c2 => _35; // in scope 23 at $DIR/reference_prop.rs:+48:13: +48:15 - let _36: &usize; // in scope 23 at $DIR/reference_prop.rs:+49:13: +49:15 + debug c2 => _43; // in scope 23 at $DIR/reference_prop.rs:+52:13: +52:15 + let _44: &usize; // in scope 23 at $DIR/reference_prop.rs:+53:13: +53:15 scope 24 { - debug b3 => _36; // in scope 24 at $DIR/reference_prop.rs:+49:13: +49:15 + debug b3 => _44; // in scope 24 at $DIR/reference_prop.rs:+53:13: +53:15 } } } @@ -119,173 +131,245 @@ } } scope 25 { - debug a => _40; // in scope 25 at $DIR/reference_prop.rs:+57:13: +57:14 - let _41: T; // in scope 25 at $DIR/reference_prop.rs:+58:13: +58:14 + debug a => _48; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14 + let _49: T; // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14 scope 26 { - debug b => _41; // in scope 26 at $DIR/reference_prop.rs:+58:13: +58:14 + debug b => _49; // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14 } } scope 27 { - debug a => _42; // in scope 27 at $DIR/reference_prop.rs:+63:13: +63:14 - let _45: T; // in scope 27 at $DIR/reference_prop.rs:+65:13: +65:14 + debug a => _52; // in scope 27 at $DIR/reference_prop.rs:+68:13: +68:14 + let _55: T; // in scope 27 at $DIR/reference_prop.rs:+70:13: +70:14 scope 28 { - debug b => _45; // in scope 28 at $DIR/reference_prop.rs:+65:13: +65:14 + debug b => _55; // in scope 28 at $DIR/reference_prop.rs:+70:13: +70:14 } } bb0: { -- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:14 _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:17: +3:24 StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 _5 = &_4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:19 StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 - _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 -- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 - StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+6:5: +6:6 - StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+6:5: +6:6 - StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 -- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 -- StorageLive(_7); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - StorageLive(_8); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:14 - _8 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+10:17: +10:24 - StorageLive(_9); // scope 4 at $DIR/reference_prop.rs:+11:13: +11:15 - _9 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+11:18: +11:25 - StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+12:13: +12:18 - _10 = &_8; // scope 5 at $DIR/reference_prop.rs:+12:21: +12:23 - StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 -- StorageLive(_12); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 -- _12 = &_9; // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 -- _11 = &(*_12); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 -+ _11 = &_9; // scope 6 at $DIR/reference_prop.rs:+13:13: +13:16 - _10 = move _11; // scope 6 at $DIR/reference_prop.rs:+13:9: +13:16 - StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+13:15: +13:16 -- StorageDead(_12); // scope 6 at $DIR/reference_prop.rs:+13:16: +13:17 - StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+15:13: +15:14 - _13 = (*_10); // scope 6 at $DIR/reference_prop.rs:+15:17: +15:19 -- _7 = const (); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_9); // scope 4 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_8); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 -- StorageDead(_7); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 -- StorageLive(_14); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - StorageLive(_15); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:14 - _15 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+20:17: +20:24 - StorageLive(_16); // scope 8 at $DIR/reference_prop.rs:+21:13: +21:14 - _16 = &_15; // scope 8 at $DIR/reference_prop.rs:+21:17: +21:19 - StorageLive(_17); // scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 - _17 = &_16; // scope 9 at $DIR/reference_prop.rs:+22:17: +22:19 - StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 - _18 = (*_16); // scope 10 at $DIR/reference_prop.rs:+23:17: +23:19 -- _14 = const (); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_17); // scope 9 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_16); // scope 8 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_15); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 -- StorageDead(_14); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 -- StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - StorageLive(_20); // scope 0 at $DIR/reference_prop.rs:+28:13: +28:14 - _20 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+28:17: +28:24 - StorageLive(_21); // scope 12 at $DIR/reference_prop.rs:+29:13: +29:18 - _21 = &_20; // scope 12 at $DIR/reference_prop.rs:+29:21: +29:23 - StorageLive(_22); // scope 13 at $DIR/reference_prop.rs:+30:13: +30:14 - _22 = &mut _21; // scope 13 at $DIR/reference_prop.rs:+30:17: +30:23 - StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+31:13: +31:14 - _23 = (*_21); // scope 14 at $DIR/reference_prop.rs:+31:17: +31:19 -- _19 = const (); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_22); // scope 13 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_21); // scope 12 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_20); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 -- StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 -- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+36:13: +36:14 - _25 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+36:17: +36:24 - StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+37:13: +37:14 - _26 = &_25; // scope 16 at $DIR/reference_prop.rs:+37:17: +37:19 - StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+38:13: +38:14 -- _27 = (*_26); // scope 17 at $DIR/reference_prop.rs:+38:17: +38:19 -+ _27 = _25; // scope 17 at $DIR/reference_prop.rs:+38:17: +38:19 - StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+39:9: +39:18 - StorageLive(_29); // scope 18 at $DIR/reference_prop.rs:+39:16: +39:17 - _29 = _26; // scope 18 at $DIR/reference_prop.rs:+39:16: +39:17 - _28 = opaque::<&usize>(move _29) -> bb1; // scope 18 at $DIR/reference_prop.rs:+39:9: +39:18 + StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 + StorageLive(_8); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 + _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 + _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 // mir::Constant - // + span: $DIR/reference_prop.rs:48:9: 48:15 - // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } + // + span: $DIR/reference_prop.rs:15:9: 15:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } bb1: { - StorageDead(_29); // scope 18 at $DIR/reference_prop.rs:+39:17: +39:18 - StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+39:18: +39:19 -- _24 = const (); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+40:5: +40:6 - StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+40:5: +40:6 - StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 -- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 -- StorageLive(_30); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+44:13: +44:14 - _31 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+44:17: +44:24 - StorageLive(_32); // scope 19 at $DIR/reference_prop.rs:+45:13: +45:15 - _32 = &_31; // scope 19 at $DIR/reference_prop.rs:+45:18: +45:20 - StorageLive(_33); // scope 20 at $DIR/reference_prop.rs:+46:13: +46:14 -- _33 = (*_32); // scope 20 at $DIR/reference_prop.rs:+46:17: +46:20 -+ _33 = _31; // scope 20 at $DIR/reference_prop.rs:+46:17: +46:20 - StorageLive(_34); // scope 21 at $DIR/reference_prop.rs:+47:13: +47:15 - _34 = _32; // scope 21 at $DIR/reference_prop.rs:+47:18: +47:20 - StorageLive(_35); // scope 22 at $DIR/reference_prop.rs:+48:13: +48:15 -- _35 = (*_34); // scope 22 at $DIR/reference_prop.rs:+48:18: +48:21 -+ _35 = _31; // scope 22 at $DIR/reference_prop.rs:+48:18: +48:21 - StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+49:13: +49:15 - _36 = _34; // scope 23 at $DIR/reference_prop.rs:+49:18: +49:20 - StorageLive(_37); // scope 24 at $DIR/reference_prop.rs:+52:9: +52:19 - StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+52:16: +52:18 - _38 = _36; // scope 24 at $DIR/reference_prop.rs:+52:16: +52:18 - _37 = opaque::<&usize>(move _38) -> bb2; // scope 24 at $DIR/reference_prop.rs:+52:9: +52:19 + StorageDead(_8); // scope 3 at $DIR/reference_prop.rs:+6:18: +6:19 + StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20 +- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageLive(_10); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:14 + _10 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+11:17: +11:24 + StorageLive(_11); // scope 4 at $DIR/reference_prop.rs:+12:13: +12:15 + _11 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+12:18: +12:25 + StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+13:13: +13:18 + _12 = &_10; // scope 5 at $DIR/reference_prop.rs:+13:21: +13:23 + StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 +- StorageLive(_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 +- _14 = &_11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 +- _13 = &(*_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 ++ _13 = &_11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:16 + _12 = move _13; // scope 6 at $DIR/reference_prop.rs:+14:9: +14:16 + StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+14:15: +14:16 +- StorageDead(_14); // scope 6 at $DIR/reference_prop.rs:+14:16: +14:17 + StorageLive(_15); // scope 6 at $DIR/reference_prop.rs:+16:13: +16:14 + _15 = (*_12); // scope 6 at $DIR/reference_prop.rs:+16:17: +16:19 + StorageLive(_16); // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 + StorageLive(_17); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 + _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 + _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 // mir::Constant - // + span: $DIR/reference_prop.rs:61:9: 61:15 - // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } + // + span: $DIR/reference_prop.rs:26:9: 26:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } bb2: { - StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+52:18: +52:19 - StorageDead(_37); // scope 24 at $DIR/reference_prop.rs:+52:19: +52:20 -- _30 = const (); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_35); // scope 22 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_34); // scope 21 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_33); // scope 20 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_32); // scope 19 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 -- StorageDead(_30); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 -- StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 - StorageLive(_40); // scope 0 at $DIR/reference_prop.rs:+57:13: +57:14 - _40 = &(*_1); // scope 0 at $DIR/reference_prop.rs:+57:17: +57:25 - StorageLive(_41); // scope 25 at $DIR/reference_prop.rs:+58:13: +58:14 -- _41 = (*_40); // scope 25 at $DIR/reference_prop.rs:+58:17: +58:19 -- _39 = const (); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 -+ _41 = (*_1); // scope 25 at $DIR/reference_prop.rs:+58:17: +58:19 - StorageDead(_41); // scope 25 at $DIR/reference_prop.rs:+59:5: +59:6 - StorageDead(_40); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 -- StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 - StorageLive(_42); // scope 0 at $DIR/reference_prop.rs:+63:13: +63:14 - _42 = &(*_2); // scope 0 at $DIR/reference_prop.rs:+63:17: +63:27 - StorageLive(_43); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 -- StorageLive(_44); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 -- _44 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 -- _43 = &(*_44); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 -+ _43 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:28 - _2 = move _43; // scope 27 at $DIR/reference_prop.rs:+64:9: +64:28 - StorageDead(_43); // scope 27 at $DIR/reference_prop.rs:+64:27: +64:28 -- StorageDead(_44); // scope 27 at $DIR/reference_prop.rs:+64:28: +64:29 - StorageLive(_45); // scope 27 at $DIR/reference_prop.rs:+65:13: +65:14 - _45 = (*_42); // scope 27 at $DIR/reference_prop.rs:+65:17: +65:19 - _0 = const (); // scope 0 at $DIR/reference_prop.rs:+62:5: +66:6 - StorageDead(_45); // scope 27 at $DIR/reference_prop.rs:+66:5: +66:6 - StorageDead(_42); // scope 0 at $DIR/reference_prop.rs:+66:5: +66:6 - return; // scope 0 at $DIR/reference_prop.rs:+67:2: +67:2 + StorageDead(_17); // scope 7 at $DIR/reference_prop.rs:+17:18: +17:19 + StorageDead(_16); // scope 7 at $DIR/reference_prop.rs:+17:19: +17:20 +- _9 = const (); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageDead(_15); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_11); // scope 4 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+22:13: +22:14 + _19 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+22:17: +22:24 + StorageLive(_20); // scope 8 at $DIR/reference_prop.rs:+23:13: +23:14 + _20 = &_19; // scope 8 at $DIR/reference_prop.rs:+23:17: +23:19 + StorageLive(_21); // scope 9 at $DIR/reference_prop.rs:+24:13: +24:14 + _21 = &_20; // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19 + StorageLive(_22); // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14 + _22 = (*_20); // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19 + StorageLive(_23); // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19 + StorageLive(_24); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18 + _24 = (); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18 + _23 = opaque::<()>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:35:9: 35:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb3: { + StorageDead(_24); // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19 + StorageDead(_23); // scope 11 at $DIR/reference_prop.rs:+26:19: +26:20 +- _18 = const (); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageDead(_22); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_21); // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_20); // scope 8 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageLive(_26); // scope 0 at $DIR/reference_prop.rs:+31:13: +31:14 + _26 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+31:17: +31:24 + StorageLive(_27); // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18 + _27 = &_26; // scope 12 at $DIR/reference_prop.rs:+32:21: +32:23 + StorageLive(_28); // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14 + _28 = &mut _27; // scope 13 at $DIR/reference_prop.rs:+33:17: +33:23 + StorageLive(_29); // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14 + _29 = (*_27); // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19 + StorageLive(_30); // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19 + StorageLive(_31); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18 + _31 = (); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18 + _30 = opaque::<()>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:44:9: 44:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb4: { + StorageDead(_31); // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19 + StorageDead(_30); // scope 15 at $DIR/reference_prop.rs:+35:19: +35:20 +- _25 = const (); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageDead(_29); // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_28); // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_27); // scope 12 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_26); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageLive(_32); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageLive(_33); // scope 0 at $DIR/reference_prop.rs:+40:13: +40:14 + _33 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+40:17: +40:24 + StorageLive(_34); // scope 16 at $DIR/reference_prop.rs:+41:13: +41:14 + _34 = &_33; // scope 16 at $DIR/reference_prop.rs:+41:17: +41:19 + StorageLive(_35); // scope 17 at $DIR/reference_prop.rs:+42:13: +42:14 +- _35 = (*_34); // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19 ++ _35 = _33; // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19 + StorageLive(_36); // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 + StorageLive(_37); // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 + _37 = _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 + _36 = opaque::<&usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:52:9: 52:15 + // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } + } + + bb5: { + StorageDead(_37); // scope 18 at $DIR/reference_prop.rs:+43:17: +43:18 + StorageDead(_36); // scope 18 at $DIR/reference_prop.rs:+43:18: +43:19 +- _32 = const (); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageDead(_35); // scope 17 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_34); // scope 16 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_33); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageDead(_32); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+48:13: +48:14 + _39 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+48:17: +48:24 + StorageLive(_40); // scope 19 at $DIR/reference_prop.rs:+49:13: +49:15 + _40 = &_39; // scope 19 at $DIR/reference_prop.rs:+49:18: +49:20 + StorageLive(_41); // scope 20 at $DIR/reference_prop.rs:+50:13: +50:14 +- _41 = (*_40); // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20 ++ _41 = _39; // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20 + StorageLive(_42); // scope 21 at $DIR/reference_prop.rs:+51:13: +51:15 + _42 = _40; // scope 21 at $DIR/reference_prop.rs:+51:18: +51:20 + StorageLive(_43); // scope 22 at $DIR/reference_prop.rs:+52:13: +52:15 +- _43 = (*_42); // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21 ++ _43 = _39; // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21 + StorageLive(_44); // scope 23 at $DIR/reference_prop.rs:+53:13: +53:15 + _44 = _42; // scope 23 at $DIR/reference_prop.rs:+53:18: +53:20 + StorageLive(_45); // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 + StorageLive(_46); // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 + _46 = _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 + _45 = opaque::<&usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:65:9: 65:15 + // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } + } + + bb6: { + StorageDead(_46); // scope 24 at $DIR/reference_prop.rs:+56:18: +56:19 + StorageDead(_45); // scope 24 at $DIR/reference_prop.rs:+56:19: +56:20 +- _38 = const (); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageDead(_44); // scope 23 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_43); // scope 22 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_42); // scope 21 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_41); // scope 20 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_40); // scope 19 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageLive(_47); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageLive(_48); // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14 + _48 = &(*_1); // scope 0 at $DIR/reference_prop.rs:+61:17: +61:25 + StorageLive(_49); // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14 +- _49 = (*_48); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19 ++ _49 = (*_1); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19 + StorageLive(_50); // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 + StorageLive(_51); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 + _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 + _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:72:9: 72:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb7: { + StorageDead(_51); // scope 26 at $DIR/reference_prop.rs:+63:18: +63:19 + StorageDead(_50); // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20 +- _47 = const (); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageDead(_49); // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6 + StorageDead(_48); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_47); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 + StorageLive(_52); // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14 + _52 = &(*_2); // scope 0 at $DIR/reference_prop.rs:+68:17: +68:27 + StorageLive(_53); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 +- StorageLive(_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 +- _54 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 +- _53 = &(*_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 ++ _53 = &(*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:28 + _2 = move _53; // scope 27 at $DIR/reference_prop.rs:+69:9: +69:28 + StorageDead(_53); // scope 27 at $DIR/reference_prop.rs:+69:27: +69:28 +- StorageDead(_54); // scope 27 at $DIR/reference_prop.rs:+69:28: +69:29 + StorageLive(_55); // scope 27 at $DIR/reference_prop.rs:+70:13: +70:14 + _55 = (*_52); // scope 27 at $DIR/reference_prop.rs:+70:17: +70:19 + StorageLive(_56); // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 + StorageLive(_57); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 + _57 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 + _56 = opaque::<()>(move _57) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:80:9: 80:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb8: { + StorageDead(_57); // scope 28 at $DIR/reference_prop.rs:+71:18: +71:19 + StorageDead(_56); // scope 28 at $DIR/reference_prop.rs:+71:19: +71:20 + _0 = const (); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageDead(_55); // scope 27 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageDead(_52); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 + return; // scope 0 at $DIR/reference_prop.rs:+73:2: +73:2 } } diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index 8edc8104f827..c1c084753324 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -5,20 +5,34 @@ debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:45: +0:51 debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:63: +0:75 let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87 - let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 - let _7: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - let mut _11: *const usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:26 - let _13: (); // in scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - let _18: (); // in scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - let _23: (); // in scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - let _27: (); // in scope 0 at $DIR/reference_prop.rs:+39:9: +39:18 - let mut _28: *const usize; // in scope 0 at $DIR/reference_prop.rs:+39:16: +39:17 - let _29: (); // in scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - let _36: (); // in scope 0 at $DIR/reference_prop.rs:+52:9: +52:19 - let mut _37: *const usize; // in scope 0 at $DIR/reference_prop.rs:+52:16: +52:18 - let _38: (); // in scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 - let _41: (); // in scope 0 at $DIR/reference_prop.rs:+62:5: +66:6 - let mut _43: *const T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:38 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19 + let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18 + let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + let mut _13: *const usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:26 + let _15: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19 + let mut _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18 + let _17: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + let _22: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:19 + let mut _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:18 + let _24: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + let _29: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:19 + let mut _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:18 + let _31: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + let _35: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18 + let mut _36: *const usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17 + let _37: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + let _44: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19 + let mut _45: *const usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18 + let _46: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + let _49: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19 + let mut _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18 + let _51: (); // in scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + let mut _53: *const T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:38 + let _55: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19 + let mut _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18 + let _61: (); // in scope 0 at $DIR/reference_prop.rs:+80:9: +80:19 + let mut _62: (); // in scope 0 at $DIR/reference_prop.rs:+80:16: +80:18 scope 1 { let _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 scope 2 { @@ -34,92 +48,92 @@ } } scope 5 { - let _8: usize; // in scope 5 at $DIR/reference_prop.rs:+10:13: +10:14 + let _10: usize; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:14 scope 6 { - debug a => _8; // in scope 6 at $DIR/reference_prop.rs:+10:13: +10:14 - let _9: usize; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:15 + debug a => _10; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:14 + let _11: usize; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:15 scope 7 { - debug a2 => _9; // in scope 7 at $DIR/reference_prop.rs:+11:13: +11:15 - let mut _10: *const usize; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:18 + debug a2 => _11; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:15 + let mut _12: *const usize; // in scope 7 at $DIR/reference_prop.rs:+13:13: +13:18 scope 8 { - debug b => _10; // in scope 8 at $DIR/reference_prop.rs:+12:13: +12:18 - let _12: usize; // in scope 8 at $DIR/reference_prop.rs:+15:13: +15:14 + debug b => _12; // in scope 8 at $DIR/reference_prop.rs:+13:13: +13:18 + let _14: usize; // in scope 8 at $DIR/reference_prop.rs:+16:13: +16:14 scope 9 { - debug c => _12; // in scope 9 at $DIR/reference_prop.rs:+15:13: +15:14 + debug c => _14; // in scope 9 at $DIR/reference_prop.rs:+16:13: +16:14 } } } } } scope 10 { - let _14: usize; // in scope 10 at $DIR/reference_prop.rs:+20:13: +20:14 + let _18: usize; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:14 scope 11 { - debug a => _14; // in scope 11 at $DIR/reference_prop.rs:+20:13: +20:14 - let _15: *const usize; // in scope 11 at $DIR/reference_prop.rs:+21:13: +21:14 + debug a => _18; // in scope 11 at $DIR/reference_prop.rs:+22:13: +22:14 + let _19: *const usize; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 scope 12 { - debug b => _15; // in scope 12 at $DIR/reference_prop.rs:+21:13: +21:14 - let _16: &*const usize; // in scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 + debug b => _19; // in scope 12 at $DIR/reference_prop.rs:+23:13: +23:14 + let _20: &*const usize; // in scope 12 at $DIR/reference_prop.rs:+24:13: +24:14 scope 13 { - debug d => _16; // in scope 13 at $DIR/reference_prop.rs:+22:13: +22:14 - let _17: usize; // in scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 + debug d => _20; // in scope 13 at $DIR/reference_prop.rs:+24:13: +24:14 + let _21: usize; // in scope 13 at $DIR/reference_prop.rs:+25:13: +25:14 scope 14 { - debug c => _17; // in scope 14 at $DIR/reference_prop.rs:+23:13: +23:14 + debug c => _21; // in scope 14 at $DIR/reference_prop.rs:+25:13: +25:14 } } } } } scope 15 { - let _19: usize; // in scope 15 at $DIR/reference_prop.rs:+28:13: +28:14 + let _25: usize; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:14 scope 16 { - debug a => _19; // in scope 16 at $DIR/reference_prop.rs:+28:13: +28:14 - let mut _20: *const usize; // in scope 16 at $DIR/reference_prop.rs:+29:13: +29:18 + debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+31:13: +31:14 + let mut _26: *const usize; // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18 scope 17 { - debug b => _20; // in scope 17 at $DIR/reference_prop.rs:+29:13: +29:18 - let _21: &mut *const usize; // in scope 17 at $DIR/reference_prop.rs:+30:13: +30:14 + debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18 + let _27: &mut *const usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14 scope 18 { - debug d => _21; // in scope 18 at $DIR/reference_prop.rs:+30:13: +30:14 - let _22: usize; // in scope 18 at $DIR/reference_prop.rs:+31:13: +31:14 + debug d => _27; // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14 + let _28: usize; // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14 scope 19 { - debug c => _22; // in scope 19 at $DIR/reference_prop.rs:+31:13: +31:14 + debug c => _28; // in scope 19 at $DIR/reference_prop.rs:+34:13: +34:14 } } } } } scope 20 { - let _24: usize; // in scope 20 at $DIR/reference_prop.rs:+36:13: +36:14 + let _32: usize; // in scope 20 at $DIR/reference_prop.rs:+40:13: +40:14 scope 21 { - debug a => _24; // in scope 21 at $DIR/reference_prop.rs:+36:13: +36:14 - let _25: *const usize; // in scope 21 at $DIR/reference_prop.rs:+37:13: +37:14 + debug a => _32; // in scope 21 at $DIR/reference_prop.rs:+40:13: +40:14 + let _33: *const usize; // in scope 21 at $DIR/reference_prop.rs:+41:13: +41:14 scope 22 { - debug b => _25; // in scope 22 at $DIR/reference_prop.rs:+37:13: +37:14 - let _26: usize; // in scope 22 at $DIR/reference_prop.rs:+38:13: +38:14 + debug b => _33; // in scope 22 at $DIR/reference_prop.rs:+41:13: +41:14 + let _34: usize; // in scope 22 at $DIR/reference_prop.rs:+42:13: +42:14 scope 23 { - debug c => _26; // in scope 23 at $DIR/reference_prop.rs:+38:13: +38:14 + debug c => _34; // in scope 23 at $DIR/reference_prop.rs:+42:13: +42:14 } } } } scope 24 { - let _30: usize; // in scope 24 at $DIR/reference_prop.rs:+44:13: +44:14 + let _38: usize; // in scope 24 at $DIR/reference_prop.rs:+48:13: +48:14 scope 25 { - debug a => _30; // in scope 25 at $DIR/reference_prop.rs:+44:13: +44:14 - let _31: *const usize; // in scope 25 at $DIR/reference_prop.rs:+45:13: +45:15 + debug a => _38; // in scope 25 at $DIR/reference_prop.rs:+48:13: +48:14 + let _39: *const usize; // in scope 25 at $DIR/reference_prop.rs:+49:13: +49:15 scope 26 { - debug b1 => _31; // in scope 26 at $DIR/reference_prop.rs:+45:13: +45:15 - let _32: usize; // in scope 26 at $DIR/reference_prop.rs:+46:13: +46:14 + debug b1 => _39; // in scope 26 at $DIR/reference_prop.rs:+49:13: +49:15 + let _40: usize; // in scope 26 at $DIR/reference_prop.rs:+50:13: +50:14 scope 27 { - debug c => _32; // in scope 27 at $DIR/reference_prop.rs:+46:13: +46:14 - let _33: *const usize; // in scope 27 at $DIR/reference_prop.rs:+47:13: +47:15 + debug c => _40; // in scope 27 at $DIR/reference_prop.rs:+50:13: +50:14 + let _41: *const usize; // in scope 27 at $DIR/reference_prop.rs:+51:13: +51:15 scope 28 { - debug b2 => _33; // in scope 28 at $DIR/reference_prop.rs:+47:13: +47:15 - let _34: usize; // in scope 28 at $DIR/reference_prop.rs:+48:13: +48:15 + debug b2 => _41; // in scope 28 at $DIR/reference_prop.rs:+51:13: +51:15 + let _42: usize; // in scope 28 at $DIR/reference_prop.rs:+52:13: +52:15 scope 29 { - debug c2 => _34; // in scope 29 at $DIR/reference_prop.rs:+48:13: +48:15 - let _35: *const usize; // in scope 29 at $DIR/reference_prop.rs:+49:13: +49:15 + debug c2 => _42; // in scope 29 at $DIR/reference_prop.rs:+52:13: +52:15 + let _43: *const usize; // in scope 29 at $DIR/reference_prop.rs:+53:13: +53:15 scope 30 { - debug b3 => _35; // in scope 30 at $DIR/reference_prop.rs:+49:13: +49:15 + debug b3 => _43; // in scope 30 at $DIR/reference_prop.rs:+53:13: +53:15 } } } @@ -128,38 +142,38 @@ } } scope 31 { - let _39: *const T; // in scope 31 at $DIR/reference_prop.rs:+57:13: +57:14 + let _47: *const T; // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14 scope 32 { - debug a => _39; // in scope 32 at $DIR/reference_prop.rs:+57:13: +57:14 - let _40: T; // in scope 32 at $DIR/reference_prop.rs:+58:13: +58:14 + debug a => _47; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14 + let _48: T; // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14 scope 33 { - debug b => _40; // in scope 33 at $DIR/reference_prop.rs:+58:13: +58:14 + debug b => _48; // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14 } } } scope 34 { - let _42: *const T; // in scope 34 at $DIR/reference_prop.rs:+63:13: +63:14 + let _52: *const T; // in scope 34 at $DIR/reference_prop.rs:+68:13: +68:14 scope 35 { - debug a => _42; // in scope 35 at $DIR/reference_prop.rs:+63:13: +63:14 - let _44: T; // in scope 35 at $DIR/reference_prop.rs:+65:13: +65:14 + debug a => _52; // in scope 35 at $DIR/reference_prop.rs:+68:13: +68:14 + let _54: T; // in scope 35 at $DIR/reference_prop.rs:+70:13: +70:14 scope 36 { - debug b => _44; // in scope 36 at $DIR/reference_prop.rs:+65:13: +65:14 + debug b => _54; // in scope 36 at $DIR/reference_prop.rs:+70:13: +70:14 } } } scope 37 { - let _45: usize; // in scope 37 at $DIR/reference_prop.rs:+70:13: +70:14 + let _57: usize; // in scope 37 at $DIR/reference_prop.rs:+76:13: +76:14 scope 38 { - debug a => _45; // in scope 38 at $DIR/reference_prop.rs:+70:13: +70:14 - let _46: *const usize; // in scope 38 at $DIR/reference_prop.rs:+71:13: +71:14 + debug a => _57; // in scope 38 at $DIR/reference_prop.rs:+76:13: +76:14 + let _58: *const usize; // in scope 38 at $DIR/reference_prop.rs:+77:13: +77:14 scope 39 { - debug b => _46; // in scope 39 at $DIR/reference_prop.rs:+71:13: +71:14 - let _47: *const usize; // in scope 39 at $DIR/reference_prop.rs:+72:13: +72:14 + debug b => _58; // in scope 39 at $DIR/reference_prop.rs:+77:13: +77:14 + let _59: *const usize; // in scope 39 at $DIR/reference_prop.rs:+78:13: +78:14 scope 40 { - debug c => _47; // in scope 40 at $DIR/reference_prop.rs:+72:13: +72:14 - let _48: usize; // in scope 40 at $DIR/reference_prop.rs:+73:13: +73:14 + debug c => _59; // in scope 40 at $DIR/reference_prop.rs:+78:13: +78:14 + let _60: usize; // in scope 40 at $DIR/reference_prop.rs:+79:13: +79:14 scope 41 { - debug e => _48; // in scope 41 at $DIR/reference_prop.rs:+73:13: +73:14 + debug e => _60; // in scope 41 at $DIR/reference_prop.rs:+79:13: +79:14 } } } @@ -167,167 +181,251 @@ } bb0: { -- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:14 _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:17: +3:24 StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 _5 = &raw const _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:29 StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 - _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 -- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +6:6 + _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 - StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+6:5: +6:6 - StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+6:5: +6:6 - StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+6:5: +6:6 -- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 -- StorageLive(_7); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - StorageLive(_8); // scope 5 at $DIR/reference_prop.rs:+10:13: +10:14 - _8 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+10:17: +10:24 - StorageLive(_9); // scope 6 at $DIR/reference_prop.rs:+11:13: +11:15 - _9 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+11:18: +11:25 - StorageLive(_10); // scope 7 at $DIR/reference_prop.rs:+12:13: +12:18 - _10 = &raw const _8; // scope 7 at $DIR/reference_prop.rs:+12:21: +12:33 - StorageLive(_11); // scope 8 at $DIR/reference_prop.rs:+13:13: +13:26 - _11 = &raw const _9; // scope 8 at $DIR/reference_prop.rs:+13:13: +13:26 - _10 = move _11; // scope 8 at $DIR/reference_prop.rs:+13:9: +13:26 - StorageDead(_11); // scope 8 at $DIR/reference_prop.rs:+13:25: +13:26 - StorageLive(_12); // scope 8 at $DIR/reference_prop.rs:+15:13: +15:14 - _12 = (*_10); // scope 8 at $DIR/reference_prop.rs:+15:17: +15:19 -- _7 = const (); // scope 5 at $DIR/reference_prop.rs:+9:5: +16:6 - StorageDead(_12); // scope 8 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_10); // scope 7 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_9); // scope 6 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_8); // scope 5 at $DIR/reference_prop.rs:+16:5: +16:6 -- StorageDead(_7); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 -- StorageLive(_13); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - StorageLive(_14); // scope 10 at $DIR/reference_prop.rs:+20:13: +20:14 - _14 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+20:17: +20:24 - StorageLive(_15); // scope 11 at $DIR/reference_prop.rs:+21:13: +21:14 - _15 = &raw const _14; // scope 11 at $DIR/reference_prop.rs:+21:17: +21:29 - StorageLive(_16); // scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 - _16 = &_15; // scope 12 at $DIR/reference_prop.rs:+22:17: +22:19 - StorageLive(_17); // scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 - _17 = (*_15); // scope 13 at $DIR/reference_prop.rs:+23:17: +23:19 -- _13 = const (); // scope 10 at $DIR/reference_prop.rs:+19:5: +24:6 - StorageDead(_17); // scope 13 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_16); // scope 12 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_15); // scope 11 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_14); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 -- StorageDead(_13); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 -- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - StorageLive(_19); // scope 15 at $DIR/reference_prop.rs:+28:13: +28:14 - _19 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+28:17: +28:24 - StorageLive(_20); // scope 16 at $DIR/reference_prop.rs:+29:13: +29:18 - _20 = &raw const _19; // scope 16 at $DIR/reference_prop.rs:+29:21: +29:33 - StorageLive(_21); // scope 17 at $DIR/reference_prop.rs:+30:13: +30:14 - _21 = &mut _20; // scope 17 at $DIR/reference_prop.rs:+30:17: +30:23 - StorageLive(_22); // scope 18 at $DIR/reference_prop.rs:+31:13: +31:14 - _22 = (*_20); // scope 18 at $DIR/reference_prop.rs:+31:17: +31:19 -- _18 = const (); // scope 15 at $DIR/reference_prop.rs:+27:5: +32:6 - StorageDead(_22); // scope 18 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_21); // scope 17 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_20); // scope 16 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_19); // scope 15 at $DIR/reference_prop.rs:+32:5: +32:6 -- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 -- StorageLive(_23); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - StorageLive(_24); // scope 20 at $DIR/reference_prop.rs:+36:13: +36:14 - _24 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+36:17: +36:24 - StorageLive(_25); // scope 21 at $DIR/reference_prop.rs:+37:13: +37:14 - _25 = &raw const _24; // scope 21 at $DIR/reference_prop.rs:+37:17: +37:29 - StorageLive(_26); // scope 22 at $DIR/reference_prop.rs:+38:13: +38:14 -- _26 = (*_25); // scope 22 at $DIR/reference_prop.rs:+38:17: +38:19 -+ _26 = _24; // scope 22 at $DIR/reference_prop.rs:+38:17: +38:19 - StorageLive(_27); // scope 23 at $DIR/reference_prop.rs:+39:9: +39:18 - StorageLive(_28); // scope 23 at $DIR/reference_prop.rs:+39:16: +39:17 - _28 = _25; // scope 23 at $DIR/reference_prop.rs:+39:16: +39:17 - _27 = opaque::<*const usize>(move _28) -> bb1; // scope 23 at $DIR/reference_prop.rs:+39:9: +39:18 + StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 + StorageLive(_8); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 + _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 + _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 // mir::Constant - // + span: $DIR/reference_prop.rs:186:9: 186:15 - // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } + // + span: $DIR/reference_prop.rs:165:9: 165:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } bb1: { - StorageDead(_28); // scope 23 at $DIR/reference_prop.rs:+39:17: +39:18 - StorageDead(_27); // scope 23 at $DIR/reference_prop.rs:+39:18: +39:19 -- _23 = const (); // scope 20 at $DIR/reference_prop.rs:+35:5: +40:6 - StorageDead(_26); // scope 22 at $DIR/reference_prop.rs:+40:5: +40:6 - StorageDead(_25); // scope 21 at $DIR/reference_prop.rs:+40:5: +40:6 - StorageDead(_24); // scope 20 at $DIR/reference_prop.rs:+40:5: +40:6 -- StorageDead(_23); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 -- StorageLive(_29); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - StorageLive(_30); // scope 24 at $DIR/reference_prop.rs:+44:13: +44:14 - _30 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+44:17: +44:24 - StorageLive(_31); // scope 25 at $DIR/reference_prop.rs:+45:13: +45:15 - _31 = &raw const _30; // scope 25 at $DIR/reference_prop.rs:+45:18: +45:30 - StorageLive(_32); // scope 26 at $DIR/reference_prop.rs:+46:13: +46:14 -- _32 = (*_31); // scope 26 at $DIR/reference_prop.rs:+46:17: +46:20 -+ _32 = _30; // scope 26 at $DIR/reference_prop.rs:+46:17: +46:20 - StorageLive(_33); // scope 27 at $DIR/reference_prop.rs:+47:13: +47:15 - _33 = _31; // scope 27 at $DIR/reference_prop.rs:+47:18: +47:20 - StorageLive(_34); // scope 28 at $DIR/reference_prop.rs:+48:13: +48:15 -- _34 = (*_33); // scope 28 at $DIR/reference_prop.rs:+48:18: +48:21 -+ _34 = _30; // scope 28 at $DIR/reference_prop.rs:+48:18: +48:21 - StorageLive(_35); // scope 29 at $DIR/reference_prop.rs:+49:13: +49:15 - _35 = _33; // scope 29 at $DIR/reference_prop.rs:+49:18: +49:20 - StorageLive(_36); // scope 30 at $DIR/reference_prop.rs:+52:9: +52:19 - StorageLive(_37); // scope 30 at $DIR/reference_prop.rs:+52:16: +52:18 - _37 = _35; // scope 30 at $DIR/reference_prop.rs:+52:16: +52:18 - _36 = opaque::<*const usize>(move _37) -> bb2; // scope 30 at $DIR/reference_prop.rs:+52:9: +52:19 + StorageDead(_8); // scope 4 at $DIR/reference_prop.rs:+6:18: +6:19 + StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20 +- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+11:13: +11:14 + _10 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+11:17: +11:24 + StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+12:13: +12:15 + _11 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+12:18: +12:25 + StorageLive(_12); // scope 7 at $DIR/reference_prop.rs:+13:13: +13:18 + _12 = &raw const _10; // scope 7 at $DIR/reference_prop.rs:+13:21: +13:33 + StorageLive(_13); // scope 8 at $DIR/reference_prop.rs:+14:13: +14:26 + _13 = &raw const _11; // scope 8 at $DIR/reference_prop.rs:+14:13: +14:26 + _12 = move _13; // scope 8 at $DIR/reference_prop.rs:+14:9: +14:26 + StorageDead(_13); // scope 8 at $DIR/reference_prop.rs:+14:25: +14:26 + StorageLive(_14); // scope 8 at $DIR/reference_prop.rs:+16:13: +16:14 + _14 = (*_12); // scope 8 at $DIR/reference_prop.rs:+16:17: +16:19 + StorageLive(_15); // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 + StorageLive(_16); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 + _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 + _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 // mir::Constant - // + span: $DIR/reference_prop.rs:199:9: 199:15 - // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } + // + span: $DIR/reference_prop.rs:176:9: 176:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } bb2: { - StorageDead(_37); // scope 30 at $DIR/reference_prop.rs:+52:18: +52:19 - StorageDead(_36); // scope 30 at $DIR/reference_prop.rs:+52:19: +52:20 -- _29 = const (); // scope 24 at $DIR/reference_prop.rs:+43:5: +53:6 - StorageDead(_35); // scope 29 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_34); // scope 28 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_33); // scope 27 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_32); // scope 26 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_31); // scope 25 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_30); // scope 24 at $DIR/reference_prop.rs:+53:5: +53:6 -- StorageDead(_29); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 -- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 - StorageLive(_39); // scope 31 at $DIR/reference_prop.rs:+57:13: +57:14 - _39 = &raw const (*_1); // scope 31 at $DIR/reference_prop.rs:+57:17: +57:35 - StorageLive(_40); // scope 32 at $DIR/reference_prop.rs:+58:13: +58:14 -- _40 = (*_39); // scope 32 at $DIR/reference_prop.rs:+58:17: +58:19 -- _38 = const (); // scope 31 at $DIR/reference_prop.rs:+56:5: +59:6 -+ _40 = (*_1); // scope 32 at $DIR/reference_prop.rs:+58:17: +58:19 - StorageDead(_40); // scope 32 at $DIR/reference_prop.rs:+59:5: +59:6 - StorageDead(_39); // scope 31 at $DIR/reference_prop.rs:+59:5: +59:6 -- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 -- StorageLive(_41); // scope 0 at $DIR/reference_prop.rs:+62:5: +66:6 - StorageLive(_42); // scope 34 at $DIR/reference_prop.rs:+63:13: +63:14 - _42 = &raw const (*_2); // scope 34 at $DIR/reference_prop.rs:+63:17: +63:37 - StorageLive(_43); // scope 35 at $DIR/reference_prop.rs:+64:20: +64:38 - _43 = &raw const (*_1); // scope 35 at $DIR/reference_prop.rs:+64:20: +64:38 - _2 = move _43; // scope 35 at $DIR/reference_prop.rs:+64:9: +64:38 - StorageDead(_43); // scope 35 at $DIR/reference_prop.rs:+64:37: +64:38 - StorageLive(_44); // scope 35 at $DIR/reference_prop.rs:+65:13: +65:14 - _44 = (*_42); // scope 35 at $DIR/reference_prop.rs:+65:17: +65:19 -- _41 = const (); // scope 34 at $DIR/reference_prop.rs:+62:5: +66:6 - StorageDead(_44); // scope 35 at $DIR/reference_prop.rs:+66:5: +66:6 - StorageDead(_42); // scope 34 at $DIR/reference_prop.rs:+66:5: +66:6 -- StorageDead(_41); // scope 0 at $DIR/reference_prop.rs:+66:5: +66:6 - StorageLive(_45); // scope 37 at $DIR/reference_prop.rs:+70:13: +70:14 - _45 = const 13_usize; // scope 37 at $DIR/reference_prop.rs:+70:17: +70:25 - StorageLive(_46); // scope 38 at $DIR/reference_prop.rs:+71:13: +71:14 - _46 = &raw const _45; // scope 38 at $DIR/reference_prop.rs:+71:17: +71:29 - StorageLive(_47); // scope 39 at $DIR/reference_prop.rs:+72:13: +72:14 -- _47 = &raw const (*_46); // scope 39 at $DIR/reference_prop.rs:+72:17: +72:30 -+ _47 = &raw const _45; // scope 39 at $DIR/reference_prop.rs:+72:17: +72:30 - StorageLive(_48); // scope 40 at $DIR/reference_prop.rs:+73:13: +73:14 -- _48 = (*_47); // scope 40 at $DIR/reference_prop.rs:+73:17: +73:19 -+ _48 = _45; // scope 40 at $DIR/reference_prop.rs:+73:17: +73:19 - _0 = const (); // scope 37 at $DIR/reference_prop.rs:+69:5: +74:6 - StorageDead(_48); // scope 40 at $DIR/reference_prop.rs:+74:5: +74:6 - StorageDead(_47); // scope 39 at $DIR/reference_prop.rs:+74:5: +74:6 - StorageDead(_46); // scope 38 at $DIR/reference_prop.rs:+74:5: +74:6 - StorageDead(_45); // scope 37 at $DIR/reference_prop.rs:+74:5: +74:6 - return; // scope 0 at $DIR/reference_prop.rs:+75:2: +75:2 + StorageDead(_16); // scope 9 at $DIR/reference_prop.rs:+17:18: +17:19 + StorageDead(_15); // scope 9 at $DIR/reference_prop.rs:+17:19: +17:20 +- _9 = const (); // scope 5 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageDead(_14); // scope 8 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_12); // scope 7 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageLive(_17); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+22:13: +22:14 + _18 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+22:17: +22:24 + StorageLive(_19); // scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + _19 = &raw const _18; // scope 11 at $DIR/reference_prop.rs:+23:17: +23:29 + StorageLive(_20); // scope 12 at $DIR/reference_prop.rs:+24:13: +24:14 + _20 = &_19; // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19 + StorageLive(_21); // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14 + _21 = (*_19); // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19 + StorageLive(_22); // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19 + StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18 + _23 = (); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18 + _22 = opaque::<()>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:185:9: 185:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb3: { + StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19 + StorageDead(_22); // scope 14 at $DIR/reference_prop.rs:+26:19: +26:20 +- _17 = const (); // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageDead(_21); // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_20); // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_19); // scope 11 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageDead(_17); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageLive(_25); // scope 15 at $DIR/reference_prop.rs:+31:13: +31:14 + _25 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+31:17: +31:24 + StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18 + _26 = &raw const _25; // scope 16 at $DIR/reference_prop.rs:+32:21: +32:33 + StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14 + _27 = &mut _26; // scope 17 at $DIR/reference_prop.rs:+33:17: +33:23 + StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14 + _28 = (*_26); // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19 + StorageLive(_29); // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19 + StorageLive(_30); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18 + _30 = (); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18 + _29 = opaque::<()>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:194:9: 194:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb4: { + StorageDead(_30); // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19 + StorageDead(_29); // scope 19 at $DIR/reference_prop.rs:+35:19: +35:20 +- _24 = const (); // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_25); // scope 15 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageLive(_32); // scope 20 at $DIR/reference_prop.rs:+40:13: +40:14 + _32 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+40:17: +40:24 + StorageLive(_33); // scope 21 at $DIR/reference_prop.rs:+41:13: +41:14 + _33 = &raw const _32; // scope 21 at $DIR/reference_prop.rs:+41:17: +41:29 + StorageLive(_34); // scope 22 at $DIR/reference_prop.rs:+42:13: +42:14 +- _34 = (*_33); // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19 ++ _34 = _32; // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19 + StorageLive(_35); // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 + StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 + _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 + _35 = opaque::<*const usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:202:9: 202:15 + // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } + } + + bb5: { + StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+43:17: +43:18 + StorageDead(_35); // scope 23 at $DIR/reference_prop.rs:+43:18: +43:19 +- _31 = const (); // scope 20 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageDead(_34); // scope 22 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_33); // scope 21 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_32); // scope 20 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageLive(_37); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+48:13: +48:14 + _38 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+48:17: +48:24 + StorageLive(_39); // scope 25 at $DIR/reference_prop.rs:+49:13: +49:15 + _39 = &raw const _38; // scope 25 at $DIR/reference_prop.rs:+49:18: +49:30 + StorageLive(_40); // scope 26 at $DIR/reference_prop.rs:+50:13: +50:14 +- _40 = (*_39); // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20 ++ _40 = _38; // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20 + StorageLive(_41); // scope 27 at $DIR/reference_prop.rs:+51:13: +51:15 + _41 = _39; // scope 27 at $DIR/reference_prop.rs:+51:18: +51:20 + StorageLive(_42); // scope 28 at $DIR/reference_prop.rs:+52:13: +52:15 +- _42 = (*_41); // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21 ++ _42 = _38; // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21 + StorageLive(_43); // scope 29 at $DIR/reference_prop.rs:+53:13: +53:15 + _43 = _41; // scope 29 at $DIR/reference_prop.rs:+53:18: +53:20 + StorageLive(_44); // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 + StorageLive(_45); // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 + _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 + _44 = opaque::<*const usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:215:9: 215:15 + // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } + } + + bb6: { + StorageDead(_45); // scope 30 at $DIR/reference_prop.rs:+56:18: +56:19 + StorageDead(_44); // scope 30 at $DIR/reference_prop.rs:+56:19: +56:20 +- _37 = const (); // scope 24 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageDead(_43); // scope 29 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_42); // scope 28 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_41); // scope 27 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_40); // scope 26 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_39); // scope 25 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageDead(_37); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageLive(_46); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageLive(_47); // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14 + _47 = &raw const (*_1); // scope 31 at $DIR/reference_prop.rs:+61:17: +61:35 + StorageLive(_48); // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14 +- _48 = (*_47); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19 ++ _48 = (*_1); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19 + StorageLive(_49); // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 + StorageLive(_50); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 + _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 + _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:222:9: 222:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb7: { + StorageDead(_50); // scope 33 at $DIR/reference_prop.rs:+63:18: +63:19 + StorageDead(_49); // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20 +- _46 = const (); // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageDead(_48); // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6 + StorageDead(_47); // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_46); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageLive(_51); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageLive(_52); // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14 + _52 = &raw const (*_2); // scope 34 at $DIR/reference_prop.rs:+68:17: +68:37 + StorageLive(_53); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:38 + _53 = &raw const (*_1); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:38 + _2 = move _53; // scope 35 at $DIR/reference_prop.rs:+69:9: +69:38 + StorageDead(_53); // scope 35 at $DIR/reference_prop.rs:+69:37: +69:38 + StorageLive(_54); // scope 35 at $DIR/reference_prop.rs:+70:13: +70:14 + _54 = (*_52); // scope 35 at $DIR/reference_prop.rs:+70:17: +70:19 + StorageLive(_55); // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 + StorageLive(_56); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 + _56 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 + _55 = opaque::<()>(move _56) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:230:9: 230:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb8: { + StorageDead(_56); // scope 36 at $DIR/reference_prop.rs:+71:18: +71:19 + StorageDead(_55); // scope 36 at $DIR/reference_prop.rs:+71:19: +71:20 +- _51 = const (); // scope 34 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageDead(_54); // scope 35 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageDead(_52); // scope 34 at $DIR/reference_prop.rs:+72:5: +72:6 +- StorageDead(_51); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageLive(_57); // scope 37 at $DIR/reference_prop.rs:+76:13: +76:14 + _57 = const 13_usize; // scope 37 at $DIR/reference_prop.rs:+76:17: +76:25 + StorageLive(_58); // scope 38 at $DIR/reference_prop.rs:+77:13: +77:14 + _58 = &raw const _57; // scope 38 at $DIR/reference_prop.rs:+77:17: +77:29 + StorageLive(_59); // scope 39 at $DIR/reference_prop.rs:+78:13: +78:14 +- _59 = &raw const (*_58); // scope 39 at $DIR/reference_prop.rs:+78:17: +78:30 ++ _59 = &raw const _57; // scope 39 at $DIR/reference_prop.rs:+78:17: +78:30 + StorageLive(_60); // scope 40 at $DIR/reference_prop.rs:+79:13: +79:14 +- _60 = (*_59); // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19 ++ _60 = _57; // scope 40 at $DIR/reference_prop.rs:+79:17: +79:19 + StorageLive(_61); // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19 + StorageLive(_62); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18 + _62 = (); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18 + _61 = opaque::<()>(move _62) -> bb9; // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:239:9: 239:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb9: { + StorageDead(_62); // scope 41 at $DIR/reference_prop.rs:+80:18: +80:19 + StorageDead(_61); // scope 41 at $DIR/reference_prop.rs:+80:19: +80:20 + _0 = const (); // scope 37 at $DIR/reference_prop.rs:+75:5: +81:6 + StorageDead(_60); // scope 40 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageDead(_59); // scope 39 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageDead(_58); // scope 38 at $DIR/reference_prop.rs:+81:5: +81:6 + StorageDead(_57); // scope 37 at $DIR/reference_prop.rs:+81:5: +81:6 + return; // scope 0 at $DIR/reference_prop.rs:+82:2: +82:2 } } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff index f7bbd2a03f90..9ad9dd86d1ca 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -5,29 +5,41 @@ debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49 debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:62: +0:74 let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:87: +0:87 - let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 let mut _4: usize; // in scope 0 at $DIR/reference_prop.rs:+3:13: +3:18 - let _7: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - let mut _8: usize; // in scope 0 at $DIR/reference_prop.rs:+10:13: +10:18 - let mut _11: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:20 - let mut _12: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:20 - let _14: (); // in scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - let mut _15: usize; // in scope 0 at $DIR/reference_prop.rs:+20:13: +20:18 - let _19: (); // in scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - let mut _20: usize; // in scope 0 at $DIR/reference_prop.rs:+28:13: +28:18 - let _24: (); // in scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - let mut _25: usize; // in scope 0 at $DIR/reference_prop.rs:+36:13: +36:18 - let _28: (); // in scope 0 at $DIR/reference_prop.rs:+39:9: +39:18 - let mut _29: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+39:16: +39:17 - let _30: (); // in scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - let mut _31: usize; // in scope 0 at $DIR/reference_prop.rs:+44:13: +44:18 - let _37: (); // in scope 0 at $DIR/reference_prop.rs:+52:9: +52:19 - let mut _38: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+52:16: +52:18 - let _39: (); // in scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 - let _40: &mut T; // in scope 0 at $DIR/reference_prop.rs:+57:13: +57:14 - let _42: &mut T; // in scope 0 at $DIR/reference_prop.rs:+63:13: +63:14 - let mut _43: &mut T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:32 - let mut _44: &mut T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:32 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19 + let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18 + let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + let mut _10: usize; // in scope 0 at $DIR/reference_prop.rs:+11:13: +11:18 + let mut _13: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:20 + let mut _14: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:20 + let _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19 + let mut _17: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18 + let _18: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + let mut _19: usize; // in scope 0 at $DIR/reference_prop.rs:+22:13: +22:18 + let _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:19 + let mut _24: (); // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:18 + let _25: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + let mut _26: usize; // in scope 0 at $DIR/reference_prop.rs:+31:13: +31:18 + let _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:19 + let mut _31: (); // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:18 + let _32: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + let mut _33: usize; // in scope 0 at $DIR/reference_prop.rs:+40:13: +40:18 + let _36: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18 + let mut _37: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17 + let _38: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + let mut _39: usize; // in scope 0 at $DIR/reference_prop.rs:+48:13: +48:18 + let _45: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19 + let mut _46: &mut usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18 + let _47: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + let _48: &mut T; // in scope 0 at $DIR/reference_prop.rs:+61:13: +61:14 + let _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19 + let mut _51: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18 + let _52: &mut T; // in scope 0 at $DIR/reference_prop.rs:+68:13: +68:14 + let mut _53: &mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:32 + let mut _54: &mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:32 + let _56: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19 + let mut _57: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18 scope 1 { debug a => _4; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 let _5: &mut usize; // in scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 @@ -40,78 +52,78 @@ } } scope 4 { - debug a => _8; // in scope 4 at $DIR/reference_prop.rs:+10:13: +10:18 - let mut _9: usize; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:19 + debug a => _10; // in scope 4 at $DIR/reference_prop.rs:+11:13: +11:18 + let mut _11: usize; // in scope 4 at $DIR/reference_prop.rs:+12:13: +12:19 scope 5 { - debug a2 => _9; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:19 - let mut _10: &mut usize; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:18 + debug a2 => _11; // in scope 5 at $DIR/reference_prop.rs:+12:13: +12:19 + let mut _12: &mut usize; // in scope 5 at $DIR/reference_prop.rs:+13:13: +13:18 scope 6 { - debug b => _10; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:18 - let _13: usize; // in scope 6 at $DIR/reference_prop.rs:+15:13: +15:14 + debug b => _12; // in scope 6 at $DIR/reference_prop.rs:+13:13: +13:18 + let _15: usize; // in scope 6 at $DIR/reference_prop.rs:+16:13: +16:14 scope 7 { - debug c => _13; // in scope 7 at $DIR/reference_prop.rs:+15:13: +15:14 + debug c => _15; // in scope 7 at $DIR/reference_prop.rs:+16:13: +16:14 } } } } scope 8 { - debug a => _15; // in scope 8 at $DIR/reference_prop.rs:+20:13: +20:18 - let _16: &mut usize; // in scope 8 at $DIR/reference_prop.rs:+21:13: +21:14 + debug a => _19; // in scope 8 at $DIR/reference_prop.rs:+22:13: +22:18 + let _20: &mut usize; // in scope 8 at $DIR/reference_prop.rs:+23:13: +23:14 scope 9 { - debug b => _16; // in scope 9 at $DIR/reference_prop.rs:+21:13: +21:14 - let _17: &&mut usize; // in scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 + debug b => _20; // in scope 9 at $DIR/reference_prop.rs:+23:13: +23:14 + let _21: &&mut usize; // in scope 9 at $DIR/reference_prop.rs:+24:13: +24:14 scope 10 { - debug d => _17; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:14 - let _18: usize; // in scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 + debug d => _21; // in scope 10 at $DIR/reference_prop.rs:+24:13: +24:14 + let _22: usize; // in scope 10 at $DIR/reference_prop.rs:+25:13: +25:14 scope 11 { - debug c => _18; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + debug c => _22; // in scope 11 at $DIR/reference_prop.rs:+25:13: +25:14 } } } } scope 12 { - debug a => _20; // in scope 12 at $DIR/reference_prop.rs:+28:13: +28:18 - let mut _21: &mut usize; // in scope 12 at $DIR/reference_prop.rs:+29:13: +29:18 + debug a => _26; // in scope 12 at $DIR/reference_prop.rs:+31:13: +31:18 + let mut _27: &mut usize; // in scope 12 at $DIR/reference_prop.rs:+32:13: +32:18 scope 13 { - debug b => _21; // in scope 13 at $DIR/reference_prop.rs:+29:13: +29:18 - let _22: &mut &mut usize; // in scope 13 at $DIR/reference_prop.rs:+30:13: +30:14 + debug b => _27; // in scope 13 at $DIR/reference_prop.rs:+32:13: +32:18 + let _28: &mut &mut usize; // in scope 13 at $DIR/reference_prop.rs:+33:13: +33:14 scope 14 { - debug d => _22; // in scope 14 at $DIR/reference_prop.rs:+30:13: +30:14 - let _23: usize; // in scope 14 at $DIR/reference_prop.rs:+31:13: +31:14 + debug d => _28; // in scope 14 at $DIR/reference_prop.rs:+33:13: +33:14 + let _29: usize; // in scope 14 at $DIR/reference_prop.rs:+34:13: +34:14 scope 15 { - debug c => _23; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:14 + debug c => _29; // in scope 15 at $DIR/reference_prop.rs:+34:13: +34:14 } } } } scope 16 { - debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+36:13: +36:18 - let _26: &mut usize; // in scope 16 at $DIR/reference_prop.rs:+37:13: +37:14 + debug a => _33; // in scope 16 at $DIR/reference_prop.rs:+40:13: +40:18 + let _34: &mut usize; // in scope 16 at $DIR/reference_prop.rs:+41:13: +41:14 scope 17 { - debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+37:13: +37:14 - let _27: usize; // in scope 17 at $DIR/reference_prop.rs:+38:13: +38:14 + debug b => _34; // in scope 17 at $DIR/reference_prop.rs:+41:13: +41:14 + let _35: usize; // in scope 17 at $DIR/reference_prop.rs:+42:13: +42:14 scope 18 { - debug c => _27; // in scope 18 at $DIR/reference_prop.rs:+38:13: +38:14 + debug c => _35; // in scope 18 at $DIR/reference_prop.rs:+42:13: +42:14 } } } scope 19 { - debug a => _31; // in scope 19 at $DIR/reference_prop.rs:+44:13: +44:18 - let _32: &mut usize; // in scope 19 at $DIR/reference_prop.rs:+45:13: +45:15 + debug a => _39; // in scope 19 at $DIR/reference_prop.rs:+48:13: +48:18 + let _40: &mut usize; // in scope 19 at $DIR/reference_prop.rs:+49:13: +49:15 scope 20 { - debug b1 => _32; // in scope 20 at $DIR/reference_prop.rs:+45:13: +45:15 - let _33: usize; // in scope 20 at $DIR/reference_prop.rs:+46:13: +46:14 + debug b1 => _40; // in scope 20 at $DIR/reference_prop.rs:+49:13: +49:15 + let _41: usize; // in scope 20 at $DIR/reference_prop.rs:+50:13: +50:14 scope 21 { - debug c => _33; // in scope 21 at $DIR/reference_prop.rs:+46:13: +46:14 - let _34: &mut usize; // in scope 21 at $DIR/reference_prop.rs:+47:13: +47:15 + debug c => _41; // in scope 21 at $DIR/reference_prop.rs:+50:13: +50:14 + let _42: &mut usize; // in scope 21 at $DIR/reference_prop.rs:+51:13: +51:15 scope 22 { - debug b2 => _34; // in scope 22 at $DIR/reference_prop.rs:+47:13: +47:15 - let _35: usize; // in scope 22 at $DIR/reference_prop.rs:+48:13: +48:15 + debug b2 => _42; // in scope 22 at $DIR/reference_prop.rs:+51:13: +51:15 + let _43: usize; // in scope 22 at $DIR/reference_prop.rs:+52:13: +52:15 scope 23 { - debug c2 => _35; // in scope 23 at $DIR/reference_prop.rs:+48:13: +48:15 - let _36: &mut usize; // in scope 23 at $DIR/reference_prop.rs:+49:13: +49:15 + debug c2 => _43; // in scope 23 at $DIR/reference_prop.rs:+52:13: +52:15 + let _44: &mut usize; // in scope 23 at $DIR/reference_prop.rs:+53:13: +53:15 scope 24 { - debug b3 => _36; // in scope 24 at $DIR/reference_prop.rs:+49:13: +49:15 + debug b3 => _44; // in scope 24 at $DIR/reference_prop.rs:+53:13: +53:15 } } } @@ -119,170 +131,242 @@ } } scope 25 { - debug a => _40; // in scope 25 at $DIR/reference_prop.rs:+57:13: +57:14 - let _41: T; // in scope 25 at $DIR/reference_prop.rs:+58:13: +58:14 + debug a => _48; // in scope 25 at $DIR/reference_prop.rs:+61:13: +61:14 + let _49: T; // in scope 25 at $DIR/reference_prop.rs:+62:13: +62:14 scope 26 { - debug b => _41; // in scope 26 at $DIR/reference_prop.rs:+58:13: +58:14 + debug b => _49; // in scope 26 at $DIR/reference_prop.rs:+62:13: +62:14 } } scope 27 { - debug a => _42; // in scope 27 at $DIR/reference_prop.rs:+63:13: +63:14 - let _45: T; // in scope 27 at $DIR/reference_prop.rs:+65:13: +65:14 + debug a => _52; // in scope 27 at $DIR/reference_prop.rs:+68:13: +68:14 + let _55: T; // in scope 27 at $DIR/reference_prop.rs:+70:13: +70:14 scope 28 { - debug b => _45; // in scope 28 at $DIR/reference_prop.rs:+65:13: +65:14 + debug b => _55; // in scope 28 at $DIR/reference_prop.rs:+70:13: +70:14 } } bb0: { -- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 StorageLive(_4); // scope 0 at $DIR/reference_prop.rs:+3:13: +3:18 _4 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+3:21: +3:28 StorageLive(_5); // scope 1 at $DIR/reference_prop.rs:+4:13: +4:14 _5 = &mut _4; // scope 1 at $DIR/reference_prop.rs:+4:17: +4:23 StorageLive(_6); // scope 2 at $DIR/reference_prop.rs:+5:13: +5:14 - _6 = (*_5); // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 -- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 + _6 = _4; // scope 2 at $DIR/reference_prop.rs:+5:17: +5:19 - StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+6:5: +6:6 - StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+6:5: +6:6 - StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 -- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 -- StorageLive(_7); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - StorageLive(_8); // scope 0 at $DIR/reference_prop.rs:+10:13: +10:18 - _8 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+10:21: +10:28 - StorageLive(_9); // scope 4 at $DIR/reference_prop.rs:+11:13: +11:19 - _9 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+11:22: +11:29 - StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+12:13: +12:18 - _10 = &mut _8; // scope 5 at $DIR/reference_prop.rs:+12:21: +12:27 - StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 -- StorageLive(_12); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 -- _12 = &mut _9; // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 -- _11 = &mut (*_12); // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 -+ _11 = &mut _9; // scope 6 at $DIR/reference_prop.rs:+13:13: +13:20 - _10 = move _11; // scope 6 at $DIR/reference_prop.rs:+13:9: +13:20 - StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+13:19: +13:20 -- StorageDead(_12); // scope 6 at $DIR/reference_prop.rs:+13:20: +13:21 - StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+15:13: +15:14 - _13 = (*_10); // scope 6 at $DIR/reference_prop.rs:+15:17: +15:19 -- _7 = const (); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_9); // scope 4 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_8); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 -- StorageDead(_7); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 -- StorageLive(_14); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - StorageLive(_15); // scope 0 at $DIR/reference_prop.rs:+20:13: +20:18 - _15 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+20:21: +20:28 - StorageLive(_16); // scope 8 at $DIR/reference_prop.rs:+21:13: +21:14 - _16 = &mut _15; // scope 8 at $DIR/reference_prop.rs:+21:17: +21:23 - StorageLive(_17); // scope 9 at $DIR/reference_prop.rs:+22:13: +22:14 - _17 = &_16; // scope 9 at $DIR/reference_prop.rs:+22:17: +22:19 - StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+23:13: +23:14 - _18 = (*_16); // scope 10 at $DIR/reference_prop.rs:+23:17: +23:19 -- _14 = const (); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_17); // scope 9 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_16); // scope 8 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_15); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 -- StorageDead(_14); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 -- StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - StorageLive(_20); // scope 0 at $DIR/reference_prop.rs:+28:13: +28:18 - _20 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+28:21: +28:28 - StorageLive(_21); // scope 12 at $DIR/reference_prop.rs:+29:13: +29:18 - _21 = &mut _20; // scope 12 at $DIR/reference_prop.rs:+29:21: +29:27 - StorageLive(_22); // scope 13 at $DIR/reference_prop.rs:+30:13: +30:14 - _22 = &mut _21; // scope 13 at $DIR/reference_prop.rs:+30:17: +30:23 - StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+31:13: +31:14 - _23 = (*_21); // scope 14 at $DIR/reference_prop.rs:+31:17: +31:19 -- _19 = const (); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_22); // scope 13 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_21); // scope 12 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_20); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 -- StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 -- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+36:13: +36:18 - _25 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+36:21: +36:28 - StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+37:13: +37:14 - _26 = &mut _25; // scope 16 at $DIR/reference_prop.rs:+37:17: +37:23 - StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+38:13: +38:14 - _27 = (*_26); // scope 17 at $DIR/reference_prop.rs:+38:17: +38:19 - StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+39:9: +39:18 - StorageLive(_29); // scope 18 at $DIR/reference_prop.rs:+39:16: +39:17 - _29 = move _26; // scope 18 at $DIR/reference_prop.rs:+39:16: +39:17 - _28 = opaque::<&mut usize>(move _29) -> bb1; // scope 18 at $DIR/reference_prop.rs:+39:9: +39:18 + StorageLive(_7); // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 + StorageLive(_8); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 + _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 + _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 // mir::Constant - // + span: $DIR/reference_prop.rs:117:9: 117:15 - // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } + // + span: $DIR/reference_prop.rs:90:9: 90:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } bb1: { - StorageDead(_29); // scope 18 at $DIR/reference_prop.rs:+39:17: +39:18 - StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+39:18: +39:19 -- _24 = const (); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+40:5: +40:6 - StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+40:5: +40:6 - StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 -- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 -- StorageLive(_30); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+44:13: +44:18 - _31 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+44:21: +44:28 - StorageLive(_32); // scope 19 at $DIR/reference_prop.rs:+45:13: +45:15 - _32 = &mut _31; // scope 19 at $DIR/reference_prop.rs:+45:18: +45:24 - StorageLive(_33); // scope 20 at $DIR/reference_prop.rs:+46:13: +46:14 - _33 = (*_32); // scope 20 at $DIR/reference_prop.rs:+46:17: +46:20 - StorageLive(_34); // scope 21 at $DIR/reference_prop.rs:+47:13: +47:15 - _34 = move _32; // scope 21 at $DIR/reference_prop.rs:+47:18: +47:20 - StorageLive(_35); // scope 22 at $DIR/reference_prop.rs:+48:13: +48:15 - _35 = (*_34); // scope 22 at $DIR/reference_prop.rs:+48:18: +48:21 - StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+49:13: +49:15 - _36 = move _34; // scope 23 at $DIR/reference_prop.rs:+49:18: +49:20 - StorageLive(_37); // scope 24 at $DIR/reference_prop.rs:+52:9: +52:19 - StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+52:16: +52:18 - _38 = move _36; // scope 24 at $DIR/reference_prop.rs:+52:16: +52:18 - _37 = opaque::<&mut usize>(move _38) -> bb2; // scope 24 at $DIR/reference_prop.rs:+52:9: +52:19 + StorageDead(_8); // scope 3 at $DIR/reference_prop.rs:+6:18: +6:19 + StorageDead(_7); // scope 3 at $DIR/reference_prop.rs:+6:19: +6:20 +- _3 = const (); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageDead(_6); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_5); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_4); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageLive(_10); // scope 0 at $DIR/reference_prop.rs:+11:13: +11:18 + _10 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+11:21: +11:28 + StorageLive(_11); // scope 4 at $DIR/reference_prop.rs:+12:13: +12:19 + _11 = const 7_usize; // scope 4 at $DIR/reference_prop.rs:+12:22: +12:29 + StorageLive(_12); // scope 5 at $DIR/reference_prop.rs:+13:13: +13:18 + _12 = &mut _10; // scope 5 at $DIR/reference_prop.rs:+13:21: +13:27 + StorageLive(_13); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 +- StorageLive(_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 +- _14 = &mut _11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 +- _13 = &mut (*_14); // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 ++ _13 = &mut _11; // scope 6 at $DIR/reference_prop.rs:+14:13: +14:20 + _12 = move _13; // scope 6 at $DIR/reference_prop.rs:+14:9: +14:20 + StorageDead(_13); // scope 6 at $DIR/reference_prop.rs:+14:19: +14:20 +- StorageDead(_14); // scope 6 at $DIR/reference_prop.rs:+14:20: +14:21 + StorageLive(_15); // scope 6 at $DIR/reference_prop.rs:+16:13: +16:14 + _15 = (*_12); // scope 6 at $DIR/reference_prop.rs:+16:17: +16:19 + StorageLive(_16); // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 + StorageLive(_17); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 + _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 + _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 // mir::Constant - // + span: $DIR/reference_prop.rs:130:9: 130:15 - // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } + // + span: $DIR/reference_prop.rs:101:9: 101:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } bb2: { - StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+52:18: +52:19 - StorageDead(_37); // scope 24 at $DIR/reference_prop.rs:+52:19: +52:20 -- _30 = const (); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_35); // scope 22 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_34); // scope 21 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_33); // scope 20 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_32); // scope 19 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 -- StorageDead(_30); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 -- StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 - StorageLive(_40); // scope 0 at $DIR/reference_prop.rs:+57:13: +57:14 - _40 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+57:17: +57:29 - StorageLive(_41); // scope 25 at $DIR/reference_prop.rs:+58:13: +58:14 -- _41 = (*_40); // scope 25 at $DIR/reference_prop.rs:+58:17: +58:19 -- _39 = const (); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 -+ _41 = (*_1); // scope 25 at $DIR/reference_prop.rs:+58:17: +58:19 - StorageDead(_41); // scope 25 at $DIR/reference_prop.rs:+59:5: +59:6 - StorageDead(_40); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 -- StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 - StorageLive(_42); // scope 0 at $DIR/reference_prop.rs:+63:13: +63:14 - _42 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+63:17: +63:31 - StorageLive(_43); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 -- StorageLive(_44); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 -- _44 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 -- _43 = &mut (*_44); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 -+ _43 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+64:20: +64:32 - _2 = move _43; // scope 27 at $DIR/reference_prop.rs:+64:9: +64:32 - StorageDead(_43); // scope 27 at $DIR/reference_prop.rs:+64:31: +64:32 -- StorageDead(_44); // scope 27 at $DIR/reference_prop.rs:+64:32: +64:33 - StorageLive(_45); // scope 27 at $DIR/reference_prop.rs:+65:13: +65:14 - _45 = (*_42); // scope 27 at $DIR/reference_prop.rs:+65:17: +65:19 - _0 = const (); // scope 0 at $DIR/reference_prop.rs:+62:5: +66:6 - StorageDead(_45); // scope 27 at $DIR/reference_prop.rs:+66:5: +66:6 - StorageDead(_42); // scope 0 at $DIR/reference_prop.rs:+66:5: +66:6 - return; // scope 0 at $DIR/reference_prop.rs:+67:2: +67:2 + StorageDead(_17); // scope 7 at $DIR/reference_prop.rs:+17:18: +17:19 + StorageDead(_16); // scope 7 at $DIR/reference_prop.rs:+17:19: +17:20 +- _9 = const (); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageDead(_15); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_12); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_11); // scope 4 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_10); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageLive(_19); // scope 0 at $DIR/reference_prop.rs:+22:13: +22:18 + _19 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+22:21: +22:28 + StorageLive(_20); // scope 8 at $DIR/reference_prop.rs:+23:13: +23:14 + _20 = &mut _19; // scope 8 at $DIR/reference_prop.rs:+23:17: +23:23 + StorageLive(_21); // scope 9 at $DIR/reference_prop.rs:+24:13: +24:14 + _21 = &_20; // scope 9 at $DIR/reference_prop.rs:+24:17: +24:19 + StorageLive(_22); // scope 10 at $DIR/reference_prop.rs:+25:13: +25:14 + _22 = (*_20); // scope 10 at $DIR/reference_prop.rs:+25:17: +25:19 + StorageLive(_23); // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19 + StorageLive(_24); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18 + _24 = (); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18 + _23 = opaque::<()>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:110:9: 110:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb3: { + StorageDead(_24); // scope 11 at $DIR/reference_prop.rs:+26:18: +26:19 + StorageDead(_23); // scope 11 at $DIR/reference_prop.rs:+26:19: +26:20 +- _18 = const (); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageDead(_22); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_21); // scope 9 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_20); // scope 8 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_19); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageLive(_25); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageLive(_26); // scope 0 at $DIR/reference_prop.rs:+31:13: +31:18 + _26 = const 5_usize; // scope 0 at $DIR/reference_prop.rs:+31:21: +31:28 + StorageLive(_27); // scope 12 at $DIR/reference_prop.rs:+32:13: +32:18 + _27 = &mut _26; // scope 12 at $DIR/reference_prop.rs:+32:21: +32:27 + StorageLive(_28); // scope 13 at $DIR/reference_prop.rs:+33:13: +33:14 + _28 = &mut _27; // scope 13 at $DIR/reference_prop.rs:+33:17: +33:23 + StorageLive(_29); // scope 14 at $DIR/reference_prop.rs:+34:13: +34:14 + _29 = (*_27); // scope 14 at $DIR/reference_prop.rs:+34:17: +34:19 + StorageLive(_30); // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19 + StorageLive(_31); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18 + _31 = (); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18 + _30 = opaque::<()>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:119:9: 119:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb4: { + StorageDead(_31); // scope 15 at $DIR/reference_prop.rs:+35:18: +35:19 + StorageDead(_30); // scope 15 at $DIR/reference_prop.rs:+35:19: +35:20 +- _25 = const (); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageDead(_29); // scope 14 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_28); // scope 13 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_27); // scope 12 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_26); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageDead(_25); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageLive(_32); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageLive(_33); // scope 0 at $DIR/reference_prop.rs:+40:13: +40:18 + _33 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+40:21: +40:28 + StorageLive(_34); // scope 16 at $DIR/reference_prop.rs:+41:13: +41:14 + _34 = &mut _33; // scope 16 at $DIR/reference_prop.rs:+41:17: +41:23 + StorageLive(_35); // scope 17 at $DIR/reference_prop.rs:+42:13: +42:14 + _35 = (*_34); // scope 17 at $DIR/reference_prop.rs:+42:17: +42:19 + StorageLive(_36); // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 + StorageLive(_37); // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 + _37 = move _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 + _36 = opaque::<&mut usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:127:9: 127:15 + // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } + } + + bb5: { + StorageDead(_37); // scope 18 at $DIR/reference_prop.rs:+43:17: +43:18 + StorageDead(_36); // scope 18 at $DIR/reference_prop.rs:+43:18: +43:19 +- _32 = const (); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageDead(_35); // scope 17 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_34); // scope 16 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_33); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageDead(_32); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageLive(_39); // scope 0 at $DIR/reference_prop.rs:+48:13: +48:18 + _39 = const 7_usize; // scope 0 at $DIR/reference_prop.rs:+48:21: +48:28 + StorageLive(_40); // scope 19 at $DIR/reference_prop.rs:+49:13: +49:15 + _40 = &mut _39; // scope 19 at $DIR/reference_prop.rs:+49:18: +49:24 + StorageLive(_41); // scope 20 at $DIR/reference_prop.rs:+50:13: +50:14 + _41 = (*_40); // scope 20 at $DIR/reference_prop.rs:+50:17: +50:20 + StorageLive(_42); // scope 21 at $DIR/reference_prop.rs:+51:13: +51:15 + _42 = move _40; // scope 21 at $DIR/reference_prop.rs:+51:18: +51:20 + StorageLive(_43); // scope 22 at $DIR/reference_prop.rs:+52:13: +52:15 + _43 = (*_42); // scope 22 at $DIR/reference_prop.rs:+52:18: +52:21 + StorageLive(_44); // scope 23 at $DIR/reference_prop.rs:+53:13: +53:15 + _44 = move _42; // scope 23 at $DIR/reference_prop.rs:+53:18: +53:20 + StorageLive(_45); // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 + StorageLive(_46); // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 + _46 = move _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 + _45 = opaque::<&mut usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:140:9: 140:15 + // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } + } + + bb6: { + StorageDead(_46); // scope 24 at $DIR/reference_prop.rs:+56:18: +56:19 + StorageDead(_45); // scope 24 at $DIR/reference_prop.rs:+56:19: +56:20 +- _38 = const (); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageDead(_44); // scope 23 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_43); // scope 22 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_42); // scope 21 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_41); // scope 20 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_40); // scope 19 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_39); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageLive(_47); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageLive(_48); // scope 0 at $DIR/reference_prop.rs:+61:13: +61:14 + _48 = &mut (*_1); // scope 0 at $DIR/reference_prop.rs:+61:17: +61:29 + StorageLive(_49); // scope 25 at $DIR/reference_prop.rs:+62:13: +62:14 +- _49 = (*_48); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19 ++ _49 = (*_1); // scope 25 at $DIR/reference_prop.rs:+62:17: +62:19 + StorageLive(_50); // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 + StorageLive(_51); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 + _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 + _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:147:9: 147:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb7: { + StorageDead(_51); // scope 26 at $DIR/reference_prop.rs:+63:18: +63:19 + StorageDead(_50); // scope 26 at $DIR/reference_prop.rs:+63:19: +63:20 +- _47 = const (); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageDead(_49); // scope 25 at $DIR/reference_prop.rs:+64:5: +64:6 + StorageDead(_48); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_47); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 + StorageLive(_52); // scope 0 at $DIR/reference_prop.rs:+68:13: +68:14 + _52 = &mut (*_2); // scope 0 at $DIR/reference_prop.rs:+68:17: +68:31 + StorageLive(_53); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 +- StorageLive(_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 +- _54 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 +- _53 = &mut (*_54); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 ++ _53 = &mut (*_1); // scope 27 at $DIR/reference_prop.rs:+69:20: +69:32 + _2 = move _53; // scope 27 at $DIR/reference_prop.rs:+69:9: +69:32 + StorageDead(_53); // scope 27 at $DIR/reference_prop.rs:+69:31: +69:32 +- StorageDead(_54); // scope 27 at $DIR/reference_prop.rs:+69:32: +69:33 + StorageLive(_55); // scope 27 at $DIR/reference_prop.rs:+70:13: +70:14 + _55 = (*_52); // scope 27 at $DIR/reference_prop.rs:+70:17: +70:19 + StorageLive(_56); // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 + StorageLive(_57); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 + _57 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 + _56 = opaque::<()>(move _57) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:155:9: 155:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb8: { + StorageDead(_57); // scope 28 at $DIR/reference_prop.rs:+71:18: +71:19 + StorageDead(_56); // scope 28 at $DIR/reference_prop.rs:+71:19: +71:20 + _0 = const (); // scope 0 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageDead(_55); // scope 27 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageDead(_52); // scope 0 at $DIR/reference_prop.rs:+72:5: +72:6 + return; // scope 0 at $DIR/reference_prop.rs:+73:2: +73:2 } } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff index 235964e95366..7e3cafd6380a 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -5,19 +5,31 @@ debug single => _1; // in scope 0 at $DIR/reference_prop.rs:+0:43: +0:49 debug multiple => _2; // in scope 0 at $DIR/reference_prop.rs:+0:59: +0:71 let mut _0: (); // return place in scope 0 at $DIR/reference_prop.rs:+0:81: +0:81 - let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 - let _7: (); // in scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - let mut _11: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+13:13: +13:24 - let _13: (); // in scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - let _18: (); // in scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - let _23: (); // in scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - let _27: (); // in scope 0 at $DIR/reference_prop.rs:+39:9: +39:18 - let mut _28: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+39:16: +39:17 - let _29: (); // in scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - let _36: (); // in scope 0 at $DIR/reference_prop.rs:+52:9: +52:19 - let mut _37: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+52:16: +52:18 - let _38: (); // in scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 - let mut _42: *mut T; // in scope 0 at $DIR/reference_prop.rs:+64:20: +64:36 + let _3: (); // in scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 + let _7: (); // in scope 0 at $DIR/reference_prop.rs:+6:9: +6:19 + let mut _8: (); // in scope 0 at $DIR/reference_prop.rs:+6:16: +6:18 + let _9: (); // in scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + let mut _13: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+14:13: +14:24 + let _15: (); // in scope 0 at $DIR/reference_prop.rs:+17:9: +17:19 + let mut _16: (); // in scope 0 at $DIR/reference_prop.rs:+17:16: +17:18 + let _17: (); // in scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + let _22: (); // in scope 0 at $DIR/reference_prop.rs:+26:9: +26:19 + let mut _23: (); // in scope 0 at $DIR/reference_prop.rs:+26:16: +26:18 + let _24: (); // in scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + let _29: (); // in scope 0 at $DIR/reference_prop.rs:+35:9: +35:19 + let mut _30: (); // in scope 0 at $DIR/reference_prop.rs:+35:16: +35:18 + let _31: (); // in scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + let _35: (); // in scope 0 at $DIR/reference_prop.rs:+43:9: +43:18 + let mut _36: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+43:16: +43:17 + let _37: (); // in scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + let _44: (); // in scope 0 at $DIR/reference_prop.rs:+56:9: +56:19 + let mut _45: *mut usize; // in scope 0 at $DIR/reference_prop.rs:+56:16: +56:18 + let _46: (); // in scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + let _49: (); // in scope 0 at $DIR/reference_prop.rs:+63:9: +63:19 + let mut _50: (); // in scope 0 at $DIR/reference_prop.rs:+63:16: +63:18 + let mut _52: *mut T; // in scope 0 at $DIR/reference_prop.rs:+69:20: +69:36 + let _54: (); // in scope 0 at $DIR/reference_prop.rs:+71:9: +71:19 + let mut _55: (); // in scope 0 at $DIR/reference_prop.rs:+71:16: +71:18 scope 1 { let mut _4: usize; // in scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 scope 2 { @@ -33,92 +45,92 @@ } } scope 5 { - let mut _8: usize; // in scope 5 at $DIR/reference_prop.rs:+10:13: +10:18 + let mut _10: usize; // in scope 5 at $DIR/reference_prop.rs:+11:13: +11:18 scope 6 { - debug a => _8; // in scope 6 at $DIR/reference_prop.rs:+10:13: +10:18 - let mut _9: usize; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:19 + debug a => _10; // in scope 6 at $DIR/reference_prop.rs:+11:13: +11:18 + let mut _11: usize; // in scope 6 at $DIR/reference_prop.rs:+12:13: +12:19 scope 7 { - debug a2 => _9; // in scope 7 at $DIR/reference_prop.rs:+11:13: +11:19 - let mut _10: *mut usize; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:18 + debug a2 => _11; // in scope 7 at $DIR/reference_prop.rs:+12:13: +12:19 + let mut _12: *mut usize; // in scope 7 at $DIR/reference_prop.rs:+13:13: +13:18 scope 8 { - debug b => _10; // in scope 8 at $DIR/reference_prop.rs:+12:13: +12:18 - let _12: usize; // in scope 8 at $DIR/reference_prop.rs:+15:13: +15:14 + debug b => _12; // in scope 8 at $DIR/reference_prop.rs:+13:13: +13:18 + let _14: usize; // in scope 8 at $DIR/reference_prop.rs:+16:13: +16:14 scope 9 { - debug c => _12; // in scope 9 at $DIR/reference_prop.rs:+15:13: +15:14 + debug c => _14; // in scope 9 at $DIR/reference_prop.rs:+16:13: +16:14 } } } } } scope 10 { - let mut _14: usize; // in scope 10 at $DIR/reference_prop.rs:+20:13: +20:18 + let mut _18: usize; // in scope 10 at $DIR/reference_prop.rs:+22:13: +22:18 scope 11 { - debug a => _14; // in scope 11 at $DIR/reference_prop.rs:+20:13: +20:18 - let _15: *mut usize; // in scope 11 at $DIR/reference_prop.rs:+21:13: +21:14 + debug a => _18; // in scope 11 at $DIR/reference_prop.rs:+22:13: +22:18 + let _19: *mut usize; // in scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 scope 12 { - debug b => _15; // in scope 12 at $DIR/reference_prop.rs:+21:13: +21:14 - let _16: &*mut usize; // in scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 + debug b => _19; // in scope 12 at $DIR/reference_prop.rs:+23:13: +23:14 + let _20: &*mut usize; // in scope 12 at $DIR/reference_prop.rs:+24:13: +24:14 scope 13 { - debug d => _16; // in scope 13 at $DIR/reference_prop.rs:+22:13: +22:14 - let _17: usize; // in scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 + debug d => _20; // in scope 13 at $DIR/reference_prop.rs:+24:13: +24:14 + let _21: usize; // in scope 13 at $DIR/reference_prop.rs:+25:13: +25:14 scope 14 { - debug c => _17; // in scope 14 at $DIR/reference_prop.rs:+23:13: +23:14 + debug c => _21; // in scope 14 at $DIR/reference_prop.rs:+25:13: +25:14 } } } } } scope 15 { - let mut _19: usize; // in scope 15 at $DIR/reference_prop.rs:+28:13: +28:18 + let mut _25: usize; // in scope 15 at $DIR/reference_prop.rs:+31:13: +31:18 scope 16 { - debug a => _19; // in scope 16 at $DIR/reference_prop.rs:+28:13: +28:18 - let mut _20: *mut usize; // in scope 16 at $DIR/reference_prop.rs:+29:13: +29:18 + debug a => _25; // in scope 16 at $DIR/reference_prop.rs:+31:13: +31:18 + let mut _26: *mut usize; // in scope 16 at $DIR/reference_prop.rs:+32:13: +32:18 scope 17 { - debug b => _20; // in scope 17 at $DIR/reference_prop.rs:+29:13: +29:18 - let _21: &mut *mut usize; // in scope 17 at $DIR/reference_prop.rs:+30:13: +30:14 + debug b => _26; // in scope 17 at $DIR/reference_prop.rs:+32:13: +32:18 + let _27: &mut *mut usize; // in scope 17 at $DIR/reference_prop.rs:+33:13: +33:14 scope 18 { - debug d => _21; // in scope 18 at $DIR/reference_prop.rs:+30:13: +30:14 - let _22: usize; // in scope 18 at $DIR/reference_prop.rs:+31:13: +31:14 + debug d => _27; // in scope 18 at $DIR/reference_prop.rs:+33:13: +33:14 + let _28: usize; // in scope 18 at $DIR/reference_prop.rs:+34:13: +34:14 scope 19 { - debug c => _22; // in scope 19 at $DIR/reference_prop.rs:+31:13: +31:14 + debug c => _28; // in scope 19 at $DIR/reference_prop.rs:+34:13: +34:14 } } } } } scope 20 { - let mut _24: usize; // in scope 20 at $DIR/reference_prop.rs:+36:13: +36:18 + let mut _32: usize; // in scope 20 at $DIR/reference_prop.rs:+40:13: +40:18 scope 21 { - debug a => _24; // in scope 21 at $DIR/reference_prop.rs:+36:13: +36:18 - let _25: *mut usize; // in scope 21 at $DIR/reference_prop.rs:+37:13: +37:14 + debug a => _32; // in scope 21 at $DIR/reference_prop.rs:+40:13: +40:18 + let _33: *mut usize; // in scope 21 at $DIR/reference_prop.rs:+41:13: +41:14 scope 22 { - debug b => _25; // in scope 22 at $DIR/reference_prop.rs:+37:13: +37:14 - let _26: usize; // in scope 22 at $DIR/reference_prop.rs:+38:13: +38:14 + debug b => _33; // in scope 22 at $DIR/reference_prop.rs:+41:13: +41:14 + let _34: usize; // in scope 22 at $DIR/reference_prop.rs:+42:13: +42:14 scope 23 { - debug c => _26; // in scope 23 at $DIR/reference_prop.rs:+38:13: +38:14 + debug c => _34; // in scope 23 at $DIR/reference_prop.rs:+42:13: +42:14 } } } } scope 24 { - let mut _30: usize; // in scope 24 at $DIR/reference_prop.rs:+44:13: +44:18 + let mut _38: usize; // in scope 24 at $DIR/reference_prop.rs:+48:13: +48:18 scope 25 { - debug a => _30; // in scope 25 at $DIR/reference_prop.rs:+44:13: +44:18 - let _31: *mut usize; // in scope 25 at $DIR/reference_prop.rs:+45:13: +45:15 + debug a => _38; // in scope 25 at $DIR/reference_prop.rs:+48:13: +48:18 + let _39: *mut usize; // in scope 25 at $DIR/reference_prop.rs:+49:13: +49:15 scope 26 { - debug b1 => _31; // in scope 26 at $DIR/reference_prop.rs:+45:13: +45:15 - let _32: usize; // in scope 26 at $DIR/reference_prop.rs:+46:13: +46:14 + debug b1 => _39; // in scope 26 at $DIR/reference_prop.rs:+49:13: +49:15 + let _40: usize; // in scope 26 at $DIR/reference_prop.rs:+50:13: +50:14 scope 27 { - debug c => _32; // in scope 27 at $DIR/reference_prop.rs:+46:13: +46:14 - let _33: *mut usize; // in scope 27 at $DIR/reference_prop.rs:+47:13: +47:15 + debug c => _40; // in scope 27 at $DIR/reference_prop.rs:+50:13: +50:14 + let _41: *mut usize; // in scope 27 at $DIR/reference_prop.rs:+51:13: +51:15 scope 28 { - debug b2 => _33; // in scope 28 at $DIR/reference_prop.rs:+47:13: +47:15 - let _34: usize; // in scope 28 at $DIR/reference_prop.rs:+48:13: +48:15 + debug b2 => _41; // in scope 28 at $DIR/reference_prop.rs:+51:13: +51:15 + let _42: usize; // in scope 28 at $DIR/reference_prop.rs:+52:13: +52:15 scope 29 { - debug c2 => _34; // in scope 29 at $DIR/reference_prop.rs:+48:13: +48:15 - let _35: *mut usize; // in scope 29 at $DIR/reference_prop.rs:+49:13: +49:15 + debug c2 => _42; // in scope 29 at $DIR/reference_prop.rs:+52:13: +52:15 + let _43: *mut usize; // in scope 29 at $DIR/reference_prop.rs:+53:13: +53:15 scope 30 { - debug b3 => _35; // in scope 30 at $DIR/reference_prop.rs:+49:13: +49:15 + debug b3 => _43; // in scope 30 at $DIR/reference_prop.rs:+53:13: +53:15 } } } @@ -127,168 +139,240 @@ } } scope 31 { - let _39: *mut T; // in scope 31 at $DIR/reference_prop.rs:+57:13: +57:14 + let _47: *mut T; // in scope 31 at $DIR/reference_prop.rs:+61:13: +61:14 scope 32 { - debug a => _39; // in scope 32 at $DIR/reference_prop.rs:+57:13: +57:14 - let _40: T; // in scope 32 at $DIR/reference_prop.rs:+58:13: +58:14 + debug a => _47; // in scope 32 at $DIR/reference_prop.rs:+61:13: +61:14 + let _48: T; // in scope 32 at $DIR/reference_prop.rs:+62:13: +62:14 scope 33 { - debug b => _40; // in scope 33 at $DIR/reference_prop.rs:+58:13: +58:14 + debug b => _48; // in scope 33 at $DIR/reference_prop.rs:+62:13: +62:14 } } } scope 34 { - let _41: *mut T; // in scope 34 at $DIR/reference_prop.rs:+63:13: +63:14 + let _51: *mut T; // in scope 34 at $DIR/reference_prop.rs:+68:13: +68:14 scope 35 { - debug a => _41; // in scope 35 at $DIR/reference_prop.rs:+63:13: +63:14 - let _43: T; // in scope 35 at $DIR/reference_prop.rs:+65:13: +65:14 + debug a => _51; // in scope 35 at $DIR/reference_prop.rs:+68:13: +68:14 + let _53: T; // in scope 35 at $DIR/reference_prop.rs:+70:13: +70:14 scope 36 { - debug b => _43; // in scope 36 at $DIR/reference_prop.rs:+65:13: +65:14 + debug b => _53; // in scope 36 at $DIR/reference_prop.rs:+70:13: +70:14 } } } bb0: { -- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +6:6 +- StorageLive(_3); // scope 0 at $DIR/reference_prop.rs:+2:5: +7:6 StorageLive(_4); // scope 1 at $DIR/reference_prop.rs:+3:13: +3:18 _4 = const 5_usize; // scope 1 at $DIR/reference_prop.rs:+3:21: +3:28 StorageLive(_5); // scope 2 at $DIR/reference_prop.rs:+4:13: +4:14 _5 = &raw mut _4; // scope 2 at $DIR/reference_prop.rs:+4:17: +4:27 StorageLive(_6); // scope 3 at $DIR/reference_prop.rs:+5:13: +5:14 - _6 = (*_5); // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 -- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +6:6 + _6 = _4; // scope 3 at $DIR/reference_prop.rs:+5:17: +5:19 - StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+6:5: +6:6 - StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+6:5: +6:6 - StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+6:5: +6:6 -- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+6:5: +6:6 -- StorageLive(_7); // scope 0 at $DIR/reference_prop.rs:+9:5: +16:6 - StorageLive(_8); // scope 5 at $DIR/reference_prop.rs:+10:13: +10:18 - _8 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+10:21: +10:28 - StorageLive(_9); // scope 6 at $DIR/reference_prop.rs:+11:13: +11:19 - _9 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+11:22: +11:29 - StorageLive(_10); // scope 7 at $DIR/reference_prop.rs:+12:13: +12:18 - _10 = &raw mut _8; // scope 7 at $DIR/reference_prop.rs:+12:21: +12:31 - StorageLive(_11); // scope 8 at $DIR/reference_prop.rs:+13:13: +13:24 - _11 = &raw mut _9; // scope 8 at $DIR/reference_prop.rs:+13:13: +13:24 - _10 = move _11; // scope 8 at $DIR/reference_prop.rs:+13:9: +13:24 - StorageDead(_11); // scope 8 at $DIR/reference_prop.rs:+13:23: +13:24 - StorageLive(_12); // scope 8 at $DIR/reference_prop.rs:+15:13: +15:14 - _12 = (*_10); // scope 8 at $DIR/reference_prop.rs:+15:17: +15:19 -- _7 = const (); // scope 5 at $DIR/reference_prop.rs:+9:5: +16:6 - StorageDead(_12); // scope 8 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_10); // scope 7 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_9); // scope 6 at $DIR/reference_prop.rs:+16:5: +16:6 - StorageDead(_8); // scope 5 at $DIR/reference_prop.rs:+16:5: +16:6 -- StorageDead(_7); // scope 0 at $DIR/reference_prop.rs:+16:5: +16:6 -- StorageLive(_13); // scope 0 at $DIR/reference_prop.rs:+19:5: +24:6 - StorageLive(_14); // scope 10 at $DIR/reference_prop.rs:+20:13: +20:18 - _14 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+20:21: +20:28 - StorageLive(_15); // scope 11 at $DIR/reference_prop.rs:+21:13: +21:14 - _15 = &raw mut _14; // scope 11 at $DIR/reference_prop.rs:+21:17: +21:27 - StorageLive(_16); // scope 12 at $DIR/reference_prop.rs:+22:13: +22:14 - _16 = &_15; // scope 12 at $DIR/reference_prop.rs:+22:17: +22:19 - StorageLive(_17); // scope 13 at $DIR/reference_prop.rs:+23:13: +23:14 - _17 = (*_15); // scope 13 at $DIR/reference_prop.rs:+23:17: +23:19 -- _13 = const (); // scope 10 at $DIR/reference_prop.rs:+19:5: +24:6 - StorageDead(_17); // scope 13 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_16); // scope 12 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_15); // scope 11 at $DIR/reference_prop.rs:+24:5: +24:6 - StorageDead(_14); // scope 10 at $DIR/reference_prop.rs:+24:5: +24:6 -- StorageDead(_13); // scope 0 at $DIR/reference_prop.rs:+24:5: +24:6 -- StorageLive(_18); // scope 0 at $DIR/reference_prop.rs:+27:5: +32:6 - StorageLive(_19); // scope 15 at $DIR/reference_prop.rs:+28:13: +28:18 - _19 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+28:21: +28:28 - StorageLive(_20); // scope 16 at $DIR/reference_prop.rs:+29:13: +29:18 - _20 = &raw mut _19; // scope 16 at $DIR/reference_prop.rs:+29:21: +29:31 - StorageLive(_21); // scope 17 at $DIR/reference_prop.rs:+30:13: +30:14 - _21 = &mut _20; // scope 17 at $DIR/reference_prop.rs:+30:17: +30:23 - StorageLive(_22); // scope 18 at $DIR/reference_prop.rs:+31:13: +31:14 - _22 = (*_20); // scope 18 at $DIR/reference_prop.rs:+31:17: +31:19 -- _18 = const (); // scope 15 at $DIR/reference_prop.rs:+27:5: +32:6 - StorageDead(_22); // scope 18 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_21); // scope 17 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_20); // scope 16 at $DIR/reference_prop.rs:+32:5: +32:6 - StorageDead(_19); // scope 15 at $DIR/reference_prop.rs:+32:5: +32:6 -- StorageDead(_18); // scope 0 at $DIR/reference_prop.rs:+32:5: +32:6 -- StorageLive(_23); // scope 0 at $DIR/reference_prop.rs:+35:5: +40:6 - StorageLive(_24); // scope 20 at $DIR/reference_prop.rs:+36:13: +36:18 - _24 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+36:21: +36:28 - StorageLive(_25); // scope 21 at $DIR/reference_prop.rs:+37:13: +37:14 - _25 = &raw mut _24; // scope 21 at $DIR/reference_prop.rs:+37:17: +37:27 - StorageLive(_26); // scope 22 at $DIR/reference_prop.rs:+38:13: +38:14 - _26 = (*_25); // scope 22 at $DIR/reference_prop.rs:+38:17: +38:19 - StorageLive(_27); // scope 23 at $DIR/reference_prop.rs:+39:9: +39:18 - StorageLive(_28); // scope 23 at $DIR/reference_prop.rs:+39:16: +39:17 - _28 = _25; // scope 23 at $DIR/reference_prop.rs:+39:16: +39:17 - _27 = opaque::<*mut usize>(move _28) -> bb1; // scope 23 at $DIR/reference_prop.rs:+39:9: +39:18 + StorageLive(_7); // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 + StorageLive(_8); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 + _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 + _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 // mir::Constant - // + span: $DIR/reference_prop.rs:263:9: 263:15 - // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } + // + span: $DIR/reference_prop.rs:249:9: 249:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } bb1: { - StorageDead(_28); // scope 23 at $DIR/reference_prop.rs:+39:17: +39:18 - StorageDead(_27); // scope 23 at $DIR/reference_prop.rs:+39:18: +39:19 -- _23 = const (); // scope 20 at $DIR/reference_prop.rs:+35:5: +40:6 - StorageDead(_26); // scope 22 at $DIR/reference_prop.rs:+40:5: +40:6 - StorageDead(_25); // scope 21 at $DIR/reference_prop.rs:+40:5: +40:6 - StorageDead(_24); // scope 20 at $DIR/reference_prop.rs:+40:5: +40:6 -- StorageDead(_23); // scope 0 at $DIR/reference_prop.rs:+40:5: +40:6 -- StorageLive(_29); // scope 0 at $DIR/reference_prop.rs:+43:5: +53:6 - StorageLive(_30); // scope 24 at $DIR/reference_prop.rs:+44:13: +44:18 - _30 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+44:21: +44:28 - StorageLive(_31); // scope 25 at $DIR/reference_prop.rs:+45:13: +45:15 - _31 = &raw mut _30; // scope 25 at $DIR/reference_prop.rs:+45:18: +45:28 - StorageLive(_32); // scope 26 at $DIR/reference_prop.rs:+46:13: +46:14 - _32 = (*_31); // scope 26 at $DIR/reference_prop.rs:+46:17: +46:20 - StorageLive(_33); // scope 27 at $DIR/reference_prop.rs:+47:13: +47:15 - _33 = _31; // scope 27 at $DIR/reference_prop.rs:+47:18: +47:20 - StorageLive(_34); // scope 28 at $DIR/reference_prop.rs:+48:13: +48:15 - _34 = (*_33); // scope 28 at $DIR/reference_prop.rs:+48:18: +48:21 - StorageLive(_35); // scope 29 at $DIR/reference_prop.rs:+49:13: +49:15 - _35 = _33; // scope 29 at $DIR/reference_prop.rs:+49:18: +49:20 - StorageLive(_36); // scope 30 at $DIR/reference_prop.rs:+52:9: +52:19 - StorageLive(_37); // scope 30 at $DIR/reference_prop.rs:+52:16: +52:18 - _37 = _35; // scope 30 at $DIR/reference_prop.rs:+52:16: +52:18 - _36 = opaque::<*mut usize>(move _37) -> bb2; // scope 30 at $DIR/reference_prop.rs:+52:9: +52:19 + StorageDead(_8); // scope 4 at $DIR/reference_prop.rs:+6:18: +6:19 + StorageDead(_7); // scope 4 at $DIR/reference_prop.rs:+6:19: +6:20 +- _3 = const (); // scope 1 at $DIR/reference_prop.rs:+2:5: +7:6 + StorageDead(_6); // scope 3 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_5); // scope 2 at $DIR/reference_prop.rs:+7:5: +7:6 + StorageDead(_4); // scope 1 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+7:5: +7:6 +- StorageLive(_9); // scope 0 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageLive(_10); // scope 5 at $DIR/reference_prop.rs:+11:13: +11:18 + _10 = const 5_usize; // scope 5 at $DIR/reference_prop.rs:+11:21: +11:28 + StorageLive(_11); // scope 6 at $DIR/reference_prop.rs:+12:13: +12:19 + _11 = const 7_usize; // scope 6 at $DIR/reference_prop.rs:+12:22: +12:29 + StorageLive(_12); // scope 7 at $DIR/reference_prop.rs:+13:13: +13:18 + _12 = &raw mut _10; // scope 7 at $DIR/reference_prop.rs:+13:21: +13:31 + StorageLive(_13); // scope 8 at $DIR/reference_prop.rs:+14:13: +14:24 + _13 = &raw mut _11; // scope 8 at $DIR/reference_prop.rs:+14:13: +14:24 + _12 = move _13; // scope 8 at $DIR/reference_prop.rs:+14:9: +14:24 + StorageDead(_13); // scope 8 at $DIR/reference_prop.rs:+14:23: +14:24 + StorageLive(_14); // scope 8 at $DIR/reference_prop.rs:+16:13: +16:14 + _14 = (*_12); // scope 8 at $DIR/reference_prop.rs:+16:17: +16:19 + StorageLive(_15); // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 + StorageLive(_16); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 + _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 + _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 // mir::Constant - // + span: $DIR/reference_prop.rs:276:9: 276:15 - // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } + // + span: $DIR/reference_prop.rs:260:9: 260:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } bb2: { - StorageDead(_37); // scope 30 at $DIR/reference_prop.rs:+52:18: +52:19 - StorageDead(_36); // scope 30 at $DIR/reference_prop.rs:+52:19: +52:20 -- _29 = const (); // scope 24 at $DIR/reference_prop.rs:+43:5: +53:6 - StorageDead(_35); // scope 29 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_34); // scope 28 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_33); // scope 27 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_32); // scope 26 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_31); // scope 25 at $DIR/reference_prop.rs:+53:5: +53:6 - StorageDead(_30); // scope 24 at $DIR/reference_prop.rs:+53:5: +53:6 -- StorageDead(_29); // scope 0 at $DIR/reference_prop.rs:+53:5: +53:6 -- StorageLive(_38); // scope 0 at $DIR/reference_prop.rs:+56:5: +59:6 - StorageLive(_39); // scope 31 at $DIR/reference_prop.rs:+57:13: +57:14 - _39 = &raw mut (*_1); // scope 31 at $DIR/reference_prop.rs:+57:17: +57:33 - StorageLive(_40); // scope 32 at $DIR/reference_prop.rs:+58:13: +58:14 -- _40 = (*_39); // scope 32 at $DIR/reference_prop.rs:+58:17: +58:19 -- _38 = const (); // scope 31 at $DIR/reference_prop.rs:+56:5: +59:6 -+ _40 = (*_1); // scope 32 at $DIR/reference_prop.rs:+58:17: +58:19 - StorageDead(_40); // scope 32 at $DIR/reference_prop.rs:+59:5: +59:6 - StorageDead(_39); // scope 31 at $DIR/reference_prop.rs:+59:5: +59:6 -- StorageDead(_38); // scope 0 at $DIR/reference_prop.rs:+59:5: +59:6 - StorageLive(_41); // scope 34 at $DIR/reference_prop.rs:+63:13: +63:14 - _41 = &raw mut (*_2); // scope 34 at $DIR/reference_prop.rs:+63:17: +63:35 - StorageLive(_42); // scope 35 at $DIR/reference_prop.rs:+64:20: +64:36 - _42 = &raw mut (*_1); // scope 35 at $DIR/reference_prop.rs:+64:20: +64:36 - _2 = move _42; // scope 35 at $DIR/reference_prop.rs:+64:9: +64:36 - StorageDead(_42); // scope 35 at $DIR/reference_prop.rs:+64:35: +64:36 - StorageLive(_43); // scope 35 at $DIR/reference_prop.rs:+65:13: +65:14 - _43 = (*_41); // scope 35 at $DIR/reference_prop.rs:+65:17: +65:19 - _0 = const (); // scope 34 at $DIR/reference_prop.rs:+62:5: +66:6 - StorageDead(_43); // scope 35 at $DIR/reference_prop.rs:+66:5: +66:6 - StorageDead(_41); // scope 34 at $DIR/reference_prop.rs:+66:5: +66:6 - return; // scope 0 at $DIR/reference_prop.rs:+67:2: +67:2 + StorageDead(_16); // scope 9 at $DIR/reference_prop.rs:+17:18: +17:19 + StorageDead(_15); // scope 9 at $DIR/reference_prop.rs:+17:19: +17:20 +- _9 = const (); // scope 5 at $DIR/reference_prop.rs:+10:5: +18:6 + StorageDead(_14); // scope 8 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_12); // scope 7 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_11); // scope 6 at $DIR/reference_prop.rs:+18:5: +18:6 + StorageDead(_10); // scope 5 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageDead(_9); // scope 0 at $DIR/reference_prop.rs:+18:5: +18:6 +- StorageLive(_17); // scope 0 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageLive(_18); // scope 10 at $DIR/reference_prop.rs:+22:13: +22:18 + _18 = const 5_usize; // scope 10 at $DIR/reference_prop.rs:+22:21: +22:28 + StorageLive(_19); // scope 11 at $DIR/reference_prop.rs:+23:13: +23:14 + _19 = &raw mut _18; // scope 11 at $DIR/reference_prop.rs:+23:17: +23:27 + StorageLive(_20); // scope 12 at $DIR/reference_prop.rs:+24:13: +24:14 + _20 = &_19; // scope 12 at $DIR/reference_prop.rs:+24:17: +24:19 + StorageLive(_21); // scope 13 at $DIR/reference_prop.rs:+25:13: +25:14 + _21 = (*_19); // scope 13 at $DIR/reference_prop.rs:+25:17: +25:19 + StorageLive(_22); // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19 + StorageLive(_23); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18 + _23 = (); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18 + _22 = opaque::<()>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:269:9: 269:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb3: { + StorageDead(_23); // scope 14 at $DIR/reference_prop.rs:+26:18: +26:19 + StorageDead(_22); // scope 14 at $DIR/reference_prop.rs:+26:19: +26:20 +- _17 = const (); // scope 10 at $DIR/reference_prop.rs:+21:5: +27:6 + StorageDead(_21); // scope 13 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_20); // scope 12 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_19); // scope 11 at $DIR/reference_prop.rs:+27:5: +27:6 + StorageDead(_18); // scope 10 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageDead(_17); // scope 0 at $DIR/reference_prop.rs:+27:5: +27:6 +- StorageLive(_24); // scope 0 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageLive(_25); // scope 15 at $DIR/reference_prop.rs:+31:13: +31:18 + _25 = const 5_usize; // scope 15 at $DIR/reference_prop.rs:+31:21: +31:28 + StorageLive(_26); // scope 16 at $DIR/reference_prop.rs:+32:13: +32:18 + _26 = &raw mut _25; // scope 16 at $DIR/reference_prop.rs:+32:21: +32:31 + StorageLive(_27); // scope 17 at $DIR/reference_prop.rs:+33:13: +33:14 + _27 = &mut _26; // scope 17 at $DIR/reference_prop.rs:+33:17: +33:23 + StorageLive(_28); // scope 18 at $DIR/reference_prop.rs:+34:13: +34:14 + _28 = (*_26); // scope 18 at $DIR/reference_prop.rs:+34:17: +34:19 + StorageLive(_29); // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19 + StorageLive(_30); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18 + _30 = (); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18 + _29 = opaque::<()>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:278:9: 278:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb4: { + StorageDead(_30); // scope 19 at $DIR/reference_prop.rs:+35:18: +35:19 + StorageDead(_29); // scope 19 at $DIR/reference_prop.rs:+35:19: +35:20 +- _24 = const (); // scope 15 at $DIR/reference_prop.rs:+30:5: +36:6 + StorageDead(_28); // scope 18 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_27); // scope 17 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_26); // scope 16 at $DIR/reference_prop.rs:+36:5: +36:6 + StorageDead(_25); // scope 15 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageDead(_24); // scope 0 at $DIR/reference_prop.rs:+36:5: +36:6 +- StorageLive(_31); // scope 0 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageLive(_32); // scope 20 at $DIR/reference_prop.rs:+40:13: +40:18 + _32 = const 7_usize; // scope 20 at $DIR/reference_prop.rs:+40:21: +40:28 + StorageLive(_33); // scope 21 at $DIR/reference_prop.rs:+41:13: +41:14 + _33 = &raw mut _32; // scope 21 at $DIR/reference_prop.rs:+41:17: +41:27 + StorageLive(_34); // scope 22 at $DIR/reference_prop.rs:+42:13: +42:14 + _34 = (*_33); // scope 22 at $DIR/reference_prop.rs:+42:17: +42:19 + StorageLive(_35); // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 + StorageLive(_36); // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 + _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 + _35 = opaque::<*mut usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 + // mir::Constant + // + span: $DIR/reference_prop.rs:286:9: 286:15 + // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } + } + + bb5: { + StorageDead(_36); // scope 23 at $DIR/reference_prop.rs:+43:17: +43:18 + StorageDead(_35); // scope 23 at $DIR/reference_prop.rs:+43:18: +43:19 +- _31 = const (); // scope 20 at $DIR/reference_prop.rs:+39:5: +44:6 + StorageDead(_34); // scope 22 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_33); // scope 21 at $DIR/reference_prop.rs:+44:5: +44:6 + StorageDead(_32); // scope 20 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageDead(_31); // scope 0 at $DIR/reference_prop.rs:+44:5: +44:6 +- StorageLive(_37); // scope 0 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageLive(_38); // scope 24 at $DIR/reference_prop.rs:+48:13: +48:18 + _38 = const 7_usize; // scope 24 at $DIR/reference_prop.rs:+48:21: +48:28 + StorageLive(_39); // scope 25 at $DIR/reference_prop.rs:+49:13: +49:15 + _39 = &raw mut _38; // scope 25 at $DIR/reference_prop.rs:+49:18: +49:28 + StorageLive(_40); // scope 26 at $DIR/reference_prop.rs:+50:13: +50:14 + _40 = (*_39); // scope 26 at $DIR/reference_prop.rs:+50:17: +50:20 + StorageLive(_41); // scope 27 at $DIR/reference_prop.rs:+51:13: +51:15 + _41 = _39; // scope 27 at $DIR/reference_prop.rs:+51:18: +51:20 + StorageLive(_42); // scope 28 at $DIR/reference_prop.rs:+52:13: +52:15 + _42 = (*_41); // scope 28 at $DIR/reference_prop.rs:+52:18: +52:21 + StorageLive(_43); // scope 29 at $DIR/reference_prop.rs:+53:13: +53:15 + _43 = _41; // scope 29 at $DIR/reference_prop.rs:+53:18: +53:20 + StorageLive(_44); // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 + StorageLive(_45); // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 + _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 + _44 = opaque::<*mut usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:299:9: 299:15 + // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } + } + + bb6: { + StorageDead(_45); // scope 30 at $DIR/reference_prop.rs:+56:18: +56:19 + StorageDead(_44); // scope 30 at $DIR/reference_prop.rs:+56:19: +56:20 +- _37 = const (); // scope 24 at $DIR/reference_prop.rs:+47:5: +57:6 + StorageDead(_43); // scope 29 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_42); // scope 28 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_41); // scope 27 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_40); // scope 26 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_39); // scope 25 at $DIR/reference_prop.rs:+57:5: +57:6 + StorageDead(_38); // scope 24 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageDead(_37); // scope 0 at $DIR/reference_prop.rs:+57:5: +57:6 +- StorageLive(_46); // scope 0 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageLive(_47); // scope 31 at $DIR/reference_prop.rs:+61:13: +61:14 + _47 = &raw mut (*_1); // scope 31 at $DIR/reference_prop.rs:+61:17: +61:33 + StorageLive(_48); // scope 32 at $DIR/reference_prop.rs:+62:13: +62:14 +- _48 = (*_47); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19 ++ _48 = (*_1); // scope 32 at $DIR/reference_prop.rs:+62:17: +62:19 + StorageLive(_49); // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 + StorageLive(_50); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 + _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 + _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:306:9: 306:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb7: { + StorageDead(_50); // scope 33 at $DIR/reference_prop.rs:+63:18: +63:19 + StorageDead(_49); // scope 33 at $DIR/reference_prop.rs:+63:19: +63:20 +- _46 = const (); // scope 31 at $DIR/reference_prop.rs:+60:5: +64:6 + StorageDead(_48); // scope 32 at $DIR/reference_prop.rs:+64:5: +64:6 + StorageDead(_47); // scope 31 at $DIR/reference_prop.rs:+64:5: +64:6 +- StorageDead(_46); // scope 0 at $DIR/reference_prop.rs:+64:5: +64:6 + StorageLive(_51); // scope 34 at $DIR/reference_prop.rs:+68:13: +68:14 + _51 = &raw mut (*_2); // scope 34 at $DIR/reference_prop.rs:+68:17: +68:35 + StorageLive(_52); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:36 + _52 = &raw mut (*_1); // scope 35 at $DIR/reference_prop.rs:+69:20: +69:36 + _2 = move _52; // scope 35 at $DIR/reference_prop.rs:+69:9: +69:36 + StorageDead(_52); // scope 35 at $DIR/reference_prop.rs:+69:35: +69:36 + StorageLive(_53); // scope 35 at $DIR/reference_prop.rs:+70:13: +70:14 + _53 = (*_51); // scope 35 at $DIR/reference_prop.rs:+70:17: +70:19 + StorageLive(_54); // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 + StorageLive(_55); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 + _55 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 + _54 = opaque::<()>(move _55) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 + // mir::Constant + // + span: $DIR/reference_prop.rs:314:9: 314:15 + // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } + } + + bb8: { + StorageDead(_55); // scope 36 at $DIR/reference_prop.rs:+71:18: +71:19 + StorageDead(_54); // scope 36 at $DIR/reference_prop.rs:+71:19: +71:20 + _0 = const (); // scope 34 at $DIR/reference_prop.rs:+67:5: +72:6 + StorageDead(_53); // scope 35 at $DIR/reference_prop.rs:+72:5: +72:6 + StorageDead(_51); // scope 34 at $DIR/reference_prop.rs:+72:5: +72:6 + return; // scope 0 at $DIR/reference_prop.rs:+73:2: +73:2 } } diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index 5625c20a420b..e75f376bb398 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -12,6 +12,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { let a = 5_usize; let b = &a; // This borrow is only used once. let c = *b; // This should be optimized. + opaque(()); // We use opaque to separate cases into basic blocks in the MIR. } // Propagation through a two references. @@ -22,6 +23,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { b = &a2; // `b` is assigned twice, so we cannot propagate it. let c = *b; + opaque(()); } // Propagation through a borrowed reference. @@ -29,7 +31,8 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { let a = 5_usize; let b = &a; let d = &b; - let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + let c = *b; // `b` is immutably borrowed, we know its value, but do not propagate it + opaque(()); } // Propagation through a borrowed reference. @@ -38,6 +41,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { let mut b = &a; let d = &mut b; let c = *b; // `b` is mutably borrowed, we cannot know its value. + opaque(()); } // Propagation through an escaping borrow. @@ -45,7 +49,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { let a = 7_usize; let b = &a; let c = *b; - opaque(b); // `b` escapes here, so we can only replace immutable borrow + opaque(b); // `b` escapes here, but we can still replace immutable borrow } // Propagation through a transitively escaping borrow. @@ -65,6 +69,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { { let a = &*single; let b = *a; // This should be optimized as `*single`. + opaque(()); } // Propagation a reborrow of a mutated argument. @@ -72,6 +77,7 @@ fn reference_propagation<'a, T: Copy>(single: &'a T, mut multiple: &'a T) { let a = &*multiple; multiple = &*single; let b = *a; // This should not be optimized. + opaque(()); } } @@ -81,6 +87,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m let mut a = 5_usize; let b = &mut a; // This borrow is only used once. let c = *b; // This should be optimized. + opaque(()); } // Propagation through a two references. @@ -91,6 +98,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m b = &mut a2; // `b` is assigned twice, so we cannot propagate it. let c = *b; + opaque(()); } // Propagation through a borrowed reference. @@ -99,6 +107,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m let b = &mut a; let d = &b; let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + opaque(()); } // Propagation through a borrowed reference. @@ -107,6 +116,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m let mut b = &mut a; let d = &mut b; let c = *b; // `b` is mutably borrowed, we cannot know its value. + opaque(()); } // Propagation through an escaping borrow. @@ -134,6 +144,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m { let a = &mut *single; let b = *a; // This should be optimized as `*single`. + opaque(()); } // Propagation a reborrow of a mutated argument. @@ -141,6 +152,7 @@ fn reference_propagation_mut<'a, T: Copy>(single: &'a mut T, mut multiple: &'a m let a = &mut *multiple; multiple = &mut *single; let b = *a; // This should not be optimized. + opaque(()); } } @@ -150,6 +162,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con let a = 5_usize; let b = &raw const a; // This borrow is only used once. let c = *b; // This should be optimized. + opaque(()); } // Propagation through a two references. @@ -160,6 +173,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con b = &raw const a2; // `b` is assigned twice, so we cannot propagate it. let c = *b; + opaque(()); } // Propagation through a borrowed reference. @@ -168,6 +182,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con let b = &raw const a; let d = &b; let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + opaque(()); } // Propagation through a borrowed reference. @@ -176,6 +191,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con let mut b = &raw const a; let d = &mut b; let c = *b; // `b` is mutably borrowed, we cannot know its value. + opaque(()); } // Propagation through an escaping borrow. @@ -203,6 +219,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con unsafe { let a = &raw const *single; let b = *a; // This should be optimized as `*single`. + opaque(()); } // Propagation a reborrow of a mutated argument. @@ -210,6 +227,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con let a = &raw const *multiple; multiple = &raw const *single; let b = *a; // This should not be optimized. + opaque(()); } // Propagation through a reborrow. @@ -218,6 +236,7 @@ fn reference_propagation_const_ptr(single: *const T, mut multiple: *con let b = &raw const a; let c = &raw const *b; let e = *c; + opaque(()); } } @@ -227,6 +246,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) let mut a = 5_usize; let b = &raw mut a; // This borrow is only used once. let c = *b; // This should be optimized. + opaque(()); } // Propagation through a two references. @@ -237,6 +257,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) b = &raw mut a2; // `b` is assigned twice, so we cannot propagate it. let c = *b; + opaque(()); } // Propagation through a borrowed reference. @@ -245,6 +266,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) let b = &raw mut a; let d = &b; let c = *b; // `b` is immutably borrowed, we know its value, but cannot be removed. + opaque(()); } // Propagation through a borrowed reference. @@ -253,6 +275,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) let mut b = &raw mut a; let d = &mut b; let c = *b; // `b` is mutably borrowed, we cannot know its value. + opaque(()); } // Propagation through an escaping borrow. @@ -280,6 +303,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) unsafe { let a = &raw mut *single; let b = *a; // This should be optimized as `*single`. + opaque(()); } // Propagation a reborrow of a mutated argument. @@ -287,6 +311,7 @@ fn reference_propagation_mut_ptr(single: *mut T, mut multiple: *mut T) let a = &raw mut *multiple; multiple = &raw mut *single; let b = *a; // This should not be optimized. + opaque(()); } } @@ -381,12 +406,14 @@ fn maybe_dead(m: bool) { let b = &mut y; // As we don't replace `b` in `bb2`, we cannot replace it here either. *b = 7; + // But this can still be replaced. + let u = *a; match m { true => bb1, _ => bb2 } } bb1 = { StorageDead(x); StorageDead(y); - Goto(bb2) + Call(RET, bb2, opaque(u)) } bb2 = { // As `x` may be `StorageDead`, `a` may be dangling, so we do nothing. From bde213cfe5490d67717fc022b04f03a57e5daa7f Mon Sep 17 00:00:00 2001 From: Camille GILLOT Date: Tue, 9 May 2023 19:35:21 +0000 Subject: [PATCH 96/97] Add needs-unwind. --- ....dominate_storage.ReferencePropagation.diff | 2 +- ...e_prop.maybe_dead.ReferencePropagation.diff | 6 +++--- ....multiple_storage.ReferencePropagation.diff | 2 +- ...rence_propagation.ReferencePropagation.diff | 16 ++++++++-------- ...agation_const_ptr.ReferencePropagation.diff | 18 +++++++++--------- ...e_propagation_mut.ReferencePropagation.diff | 16 ++++++++-------- ...opagation_mut_ptr.ReferencePropagation.diff | 16 ++++++++-------- tests/mir-opt/reference_prop.rs | 1 + 8 files changed, 39 insertions(+), 38 deletions(-) diff --git a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff index c8488400f905..8edc83cbf67f 100644 --- a/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.dominate_storage.ReferencePropagation.diff @@ -24,7 +24,7 @@ _5 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL _0 = opaque::(_5) -> bb3; // scope 0 at $DIR/reference_prop.rs:+16:13: +16:38 // mir::Constant - // + span: $DIR/reference_prop.rs:382:28: 382:34 + // + span: $DIR/reference_prop.rs:383:28: 383:34 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff index 50b2e152afdb..920755bdd1df 100644 --- a/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.maybe_dead.ReferencePropagation.diff @@ -29,7 +29,7 @@ StorageDead(_3); // scope 0 at $DIR/reference_prop.rs:+21:13: +21:27 _0 = opaque::(_6) -> bb2; // scope 0 at $DIR/reference_prop.rs:+22:13: +22:38 // mir::Constant - // + span: $DIR/reference_prop.rs:416:28: 416:34 + // + span: $DIR/reference_prop.rs:417:28: 417:34 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } @@ -37,7 +37,7 @@ _7 = (*_4); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL _0 = opaque::(_7) -> bb3; // scope 0 at $DIR/reference_prop.rs:+27:13: +27:38 // mir::Constant - // + span: $DIR/reference_prop.rs:421:28: 421:34 + // + span: $DIR/reference_prop.rs:422:28: 422:34 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } @@ -45,7 +45,7 @@ _8 = (*_5); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL _0 = opaque::(_8) -> bb4; // scope 0 at $DIR/reference_prop.rs:+33:13: +33:43 // mir::Constant - // + span: $DIR/reference_prop.rs:427:33: 427:39 + // + span: $DIR/reference_prop.rs:428:33: 428:39 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff index 08de44659e98..07bfdf0b2f12 100644 --- a/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.multiple_storage.ReferencePropagation.diff @@ -16,7 +16,7 @@ _3 = (*_2); // scope 0 at $SRC_DIR/core/src/intrinsics/mir.rs:LL:COL _0 = opaque::(_3) -> bb1; // scope 0 at $DIR/reference_prop.rs:+14:13: +14:43 // mir::Constant - // + span: $DIR/reference_prop.rs:356:33: 356:39 + // + span: $DIR/reference_prop.rs:357:33: 357:39 // + literal: Const { ty: fn(i32) {opaque::}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff index 04f5cc9d41f5..e41fc28461af 100644 --- a/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation.ReferencePropagation.diff @@ -159,7 +159,7 @@ _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 // mir::Constant - // + span: $DIR/reference_prop.rs:15:9: 15:15 + // + span: $DIR/reference_prop.rs:16:9: 16:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -193,7 +193,7 @@ _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 // mir::Constant - // + span: $DIR/reference_prop.rs:26:9: 26:15 + // + span: $DIR/reference_prop.rs:27:9: 27:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -220,7 +220,7 @@ _24 = (); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18 _23 = opaque::<()>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19 // mir::Constant - // + span: $DIR/reference_prop.rs:35:9: 35:15 + // + span: $DIR/reference_prop.rs:36:9: 36:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -247,7 +247,7 @@ _31 = (); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18 _30 = opaque::<()>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19 // mir::Constant - // + span: $DIR/reference_prop.rs:44:9: 44:15 + // + span: $DIR/reference_prop.rs:45:9: 45:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -273,7 +273,7 @@ _37 = _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 _36 = opaque::<&usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 // mir::Constant - // + span: $DIR/reference_prop.rs:52:9: 52:15 + // + span: $DIR/reference_prop.rs:53:9: 53:15 // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } } @@ -305,7 +305,7 @@ _46 = _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 _45 = opaque::<&usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 // mir::Constant - // + span: $DIR/reference_prop.rs:65:9: 65:15 + // + span: $DIR/reference_prop.rs:66:9: 66:15 // + literal: Const { ty: fn(&usize) {opaque::<&usize>}, val: Value() } } @@ -331,7 +331,7 @@ _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 // mir::Constant - // + span: $DIR/reference_prop.rs:72:9: 72:15 + // + span: $DIR/reference_prop.rs:73:9: 73:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -359,7 +359,7 @@ _57 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 _56 = opaque::<()>(move _57) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 // mir::Constant - // + span: $DIR/reference_prop.rs:80:9: 80:15 + // + span: $DIR/reference_prop.rs:81:9: 81:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff index c1c084753324..712727915d00 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_const_ptr.ReferencePropagation.diff @@ -194,7 +194,7 @@ _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 // mir::Constant - // + span: $DIR/reference_prop.rs:165:9: 165:15 + // + span: $DIR/reference_prop.rs:166:9: 166:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -224,7 +224,7 @@ _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 // mir::Constant - // + span: $DIR/reference_prop.rs:176:9: 176:15 + // + span: $DIR/reference_prop.rs:177:9: 177:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -251,7 +251,7 @@ _23 = (); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18 _22 = opaque::<()>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19 // mir::Constant - // + span: $DIR/reference_prop.rs:185:9: 185:15 + // + span: $DIR/reference_prop.rs:186:9: 186:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -278,7 +278,7 @@ _30 = (); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18 _29 = opaque::<()>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19 // mir::Constant - // + span: $DIR/reference_prop.rs:194:9: 194:15 + // + span: $DIR/reference_prop.rs:195:9: 195:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -304,7 +304,7 @@ _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 _35 = opaque::<*const usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 // mir::Constant - // + span: $DIR/reference_prop.rs:202:9: 202:15 + // + span: $DIR/reference_prop.rs:203:9: 203:15 // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } } @@ -336,7 +336,7 @@ _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 _44 = opaque::<*const usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 // mir::Constant - // + span: $DIR/reference_prop.rs:215:9: 215:15 + // + span: $DIR/reference_prop.rs:216:9: 216:15 // + literal: Const { ty: fn(*const usize) {opaque::<*const usize>}, val: Value() } } @@ -362,7 +362,7 @@ _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 // mir::Constant - // + span: $DIR/reference_prop.rs:222:9: 222:15 + // + span: $DIR/reference_prop.rs:223:9: 223:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -387,7 +387,7 @@ _56 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 _55 = opaque::<()>(move _56) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 // mir::Constant - // + span: $DIR/reference_prop.rs:230:9: 230:15 + // + span: $DIR/reference_prop.rs:231:9: 231:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -413,7 +413,7 @@ _62 = (); // scope 41 at $DIR/reference_prop.rs:+80:16: +80:18 _61 = opaque::<()>(move _62) -> bb9; // scope 41 at $DIR/reference_prop.rs:+80:9: +80:19 // mir::Constant - // + span: $DIR/reference_prop.rs:239:9: 239:15 + // + span: $DIR/reference_prop.rs:240:9: 240:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff index 9ad9dd86d1ca..44ddbbc30662 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut.ReferencePropagation.diff @@ -159,7 +159,7 @@ _8 = (); // scope 3 at $DIR/reference_prop.rs:+6:16: +6:18 _7 = opaque::<()>(move _8) -> bb1; // scope 3 at $DIR/reference_prop.rs:+6:9: +6:19 // mir::Constant - // + span: $DIR/reference_prop.rs:90:9: 90:15 + // + span: $DIR/reference_prop.rs:91:9: 91:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -193,7 +193,7 @@ _17 = (); // scope 7 at $DIR/reference_prop.rs:+17:16: +17:18 _16 = opaque::<()>(move _17) -> bb2; // scope 7 at $DIR/reference_prop.rs:+17:9: +17:19 // mir::Constant - // + span: $DIR/reference_prop.rs:101:9: 101:15 + // + span: $DIR/reference_prop.rs:102:9: 102:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -220,7 +220,7 @@ _24 = (); // scope 11 at $DIR/reference_prop.rs:+26:16: +26:18 _23 = opaque::<()>(move _24) -> bb3; // scope 11 at $DIR/reference_prop.rs:+26:9: +26:19 // mir::Constant - // + span: $DIR/reference_prop.rs:110:9: 110:15 + // + span: $DIR/reference_prop.rs:111:9: 111:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -247,7 +247,7 @@ _31 = (); // scope 15 at $DIR/reference_prop.rs:+35:16: +35:18 _30 = opaque::<()>(move _31) -> bb4; // scope 15 at $DIR/reference_prop.rs:+35:9: +35:19 // mir::Constant - // + span: $DIR/reference_prop.rs:119:9: 119:15 + // + span: $DIR/reference_prop.rs:120:9: 120:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -272,7 +272,7 @@ _37 = move _34; // scope 18 at $DIR/reference_prop.rs:+43:16: +43:17 _36 = opaque::<&mut usize>(move _37) -> bb5; // scope 18 at $DIR/reference_prop.rs:+43:9: +43:18 // mir::Constant - // + span: $DIR/reference_prop.rs:127:9: 127:15 + // + span: $DIR/reference_prop.rs:128:9: 128:15 // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } } @@ -302,7 +302,7 @@ _46 = move _44; // scope 24 at $DIR/reference_prop.rs:+56:16: +56:18 _45 = opaque::<&mut usize>(move _46) -> bb6; // scope 24 at $DIR/reference_prop.rs:+56:9: +56:19 // mir::Constant - // + span: $DIR/reference_prop.rs:140:9: 140:15 + // + span: $DIR/reference_prop.rs:141:9: 141:15 // + literal: Const { ty: fn(&mut usize) {opaque::<&mut usize>}, val: Value() } } @@ -328,7 +328,7 @@ _51 = (); // scope 26 at $DIR/reference_prop.rs:+63:16: +63:18 _50 = opaque::<()>(move _51) -> bb7; // scope 26 at $DIR/reference_prop.rs:+63:9: +63:19 // mir::Constant - // + span: $DIR/reference_prop.rs:147:9: 147:15 + // + span: $DIR/reference_prop.rs:148:9: 148:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -356,7 +356,7 @@ _57 = (); // scope 28 at $DIR/reference_prop.rs:+71:16: +71:18 _56 = opaque::<()>(move _57) -> bb8; // scope 28 at $DIR/reference_prop.rs:+71:9: +71:19 // mir::Constant - // + span: $DIR/reference_prop.rs:155:9: 155:15 + // + span: $DIR/reference_prop.rs:156:9: 156:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff index 7e3cafd6380a..c55b5eb4bed5 100644 --- a/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff +++ b/tests/mir-opt/reference_prop.reference_propagation_mut_ptr.ReferencePropagation.diff @@ -173,7 +173,7 @@ _8 = (); // scope 4 at $DIR/reference_prop.rs:+6:16: +6:18 _7 = opaque::<()>(move _8) -> bb1; // scope 4 at $DIR/reference_prop.rs:+6:9: +6:19 // mir::Constant - // + span: $DIR/reference_prop.rs:249:9: 249:15 + // + span: $DIR/reference_prop.rs:250:9: 250:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -203,7 +203,7 @@ _16 = (); // scope 9 at $DIR/reference_prop.rs:+17:16: +17:18 _15 = opaque::<()>(move _16) -> bb2; // scope 9 at $DIR/reference_prop.rs:+17:9: +17:19 // mir::Constant - // + span: $DIR/reference_prop.rs:260:9: 260:15 + // + span: $DIR/reference_prop.rs:261:9: 261:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -230,7 +230,7 @@ _23 = (); // scope 14 at $DIR/reference_prop.rs:+26:16: +26:18 _22 = opaque::<()>(move _23) -> bb3; // scope 14 at $DIR/reference_prop.rs:+26:9: +26:19 // mir::Constant - // + span: $DIR/reference_prop.rs:269:9: 269:15 + // + span: $DIR/reference_prop.rs:270:9: 270:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -257,7 +257,7 @@ _30 = (); // scope 19 at $DIR/reference_prop.rs:+35:16: +35:18 _29 = opaque::<()>(move _30) -> bb4; // scope 19 at $DIR/reference_prop.rs:+35:9: +35:19 // mir::Constant - // + span: $DIR/reference_prop.rs:278:9: 278:15 + // + span: $DIR/reference_prop.rs:279:9: 279:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -282,7 +282,7 @@ _36 = _33; // scope 23 at $DIR/reference_prop.rs:+43:16: +43:17 _35 = opaque::<*mut usize>(move _36) -> bb5; // scope 23 at $DIR/reference_prop.rs:+43:9: +43:18 // mir::Constant - // + span: $DIR/reference_prop.rs:286:9: 286:15 + // + span: $DIR/reference_prop.rs:287:9: 287:15 // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } } @@ -312,7 +312,7 @@ _45 = _43; // scope 30 at $DIR/reference_prop.rs:+56:16: +56:18 _44 = opaque::<*mut usize>(move _45) -> bb6; // scope 30 at $DIR/reference_prop.rs:+56:9: +56:19 // mir::Constant - // + span: $DIR/reference_prop.rs:299:9: 299:15 + // + span: $DIR/reference_prop.rs:300:9: 300:15 // + literal: Const { ty: fn(*mut usize) {opaque::<*mut usize>}, val: Value() } } @@ -338,7 +338,7 @@ _50 = (); // scope 33 at $DIR/reference_prop.rs:+63:16: +63:18 _49 = opaque::<()>(move _50) -> bb7; // scope 33 at $DIR/reference_prop.rs:+63:9: +63:19 // mir::Constant - // + span: $DIR/reference_prop.rs:306:9: 306:15 + // + span: $DIR/reference_prop.rs:307:9: 307:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } @@ -362,7 +362,7 @@ _55 = (); // scope 36 at $DIR/reference_prop.rs:+71:16: +71:18 _54 = opaque::<()>(move _55) -> bb8; // scope 36 at $DIR/reference_prop.rs:+71:9: +71:19 // mir::Constant - // + span: $DIR/reference_prop.rs:314:9: 314:15 + // + span: $DIR/reference_prop.rs:315:9: 315:15 // + literal: Const { ty: fn(()) {opaque::<()>}, val: Value() } } diff --git a/tests/mir-opt/reference_prop.rs b/tests/mir-opt/reference_prop.rs index e75f376bb398..e3e5d791464e 100644 --- a/tests/mir-opt/reference_prop.rs +++ b/tests/mir-opt/reference_prop.rs @@ -1,4 +1,5 @@ // unit-test: ReferencePropagation +// needs-unwind #![feature(raw_ref_op)] #![feature(core_intrinsics, custom_mir)] From 05ffb2f7ec532753a3f774a49d7231a18f9ee2e9 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Tue, 9 May 2023 23:04:06 +0100 Subject: [PATCH 97/97] Update cargo --- src/tools/cargo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/cargo b/src/tools/cargo index 569b648b5831..26b73d15a68f 160000 --- a/src/tools/cargo +++ b/src/tools/cargo @@ -1 +1 @@ -Subproject commit 569b648b5831ae8a515e90c80843a5287c3304ef +Subproject commit 26b73d15a68fb94579f6d3590585ec0e9d81d3d5